Esempio n. 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();
 }
 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));
 }
 function getResult($var)
 {
     // message to client browser
     return YDAjax::message('Argument submitted : ' . $var);
 }
 function msg($name = '', $email = '')
 {
     return YDAjax::message("Values of 2nd form\n*Name: {$name}\n*Email: {$email}");
 }
 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) . "'");
 }