I have a form (very simplified):
<form action='http://example.com/' method='post' name='event_form'>
<input type='text' name='foo' value='3'/>
<input type='submit' name='event_submit' value='Edit'/>
</form>
And I have an EventForm class to handle the form. The main method, process () is as follows:
public function process($submitname=false){
$success=false;
if ($submitname && isset($_POST[$submitname])){
if($success=$this->ruler->validate()){
if($success=$this->map_fields()){
$success=$this->eventholder->save();
}
}
} else {
foreach($this->gets as $var){
if(isset($_GET[$var])){
if($success= $this->__set($var,$_GET[$var])) break;
}
}
}
$this->action=(empty($this->eventholder->event_id))? ADD : EDIT;
return $success;
}
When submitting a form, this happens: $form->process('event_submit');For some reason, it isset($_POST['event_submit'])always evaluates to FALSE. Can anyone understand why?
ETA: after working with sentences, it seems that JQuery.validate () has an unexpected effect on the presentation of the form. All fields are sent, except for the "Submit" button. It looks like this is a jQuery bug:
$("form[name='event_form']").validate({
submitHandler: function(form) {
form.submit();
}
}};
Any thoughts on how to send the value of the submit button?
source
share