コード例 #1
0
 function processform($formvalues)
 {
     // if form is not valid, send errors to client side using an alert
     if (!$this->form->validate($formvalues)) {
         return YDAjax::message($this->form->getErrors(true, "\n* ", "* "));
     }
     // assign span 'myspanresult' with form values and change 'mybutton' caption
     $this->ajax->addResult('myspanresult', $this->form->getValues());
     $this->ajax->addResult('mybutton', 'Send form with YDAjax again :)');
     // return response to client browser
     return $this->ajax->processResults();
 }
コード例 #2
0
 function processform($formvalues)
 {
     // if form is not valid, send errors to client side using an alert
     if (!$this->form->validate($formvalues)) {
         return YDAjax::message($this->form->getErrors(true, "\n* ", "* "));
     }
     // if checkbox is ON we must add extra fields and validate them
     if ($this->form->getValue('ship')) {
         // add extra fields
         $this->_computeExtra();
         // validate again
         if (!$this->form->validate($formvalues)) {
             return YDAjax::message($this->form->getErrors(true, "\n* ", "* "));
         }
     }
     // return OK message
     return YDAjax::message("Thanks! \nHere goes what i got:\n\n" . var_export($this->form->getValues(), true));
 }
コード例 #3
0
 function getResult($var)
 {
     // message to client browser
     return YDAjax::message('Argument submitted : ' . $var);
 }
コード例 #4
0
 function msg($name = '', $email = '')
 {
     return YDAjax::message("Values of 2nd form\n*Name: {$name}\n*Email: {$email}");
 }
コード例 #5
0
 function defaultOne()
 {
     // get function name and arguments
     list($f_name, $f_args) = func_get_args();
     return YDAjax::message("Here goes what i got:\n* Function:  '" . $f_name . "'\n* Arguments:  '" . implode("'; '", $f_args) . "'");
 }