7.1.2.4 form
form(string $action, string $type, array $options)
Returns a form tag that submits to $action using XMLHttpRequest instead of a normal HTTP request via $type ('post' or 'get'). Otherwise, form submission will behave exactly like normal: data submitted is available at $this->data inside your controllers. If $options['update'] is specified, it will be updated with the resulting document. Callbacks can be used.
The options array should include the model name e.g.
$ajax->form('edit','post',array('model'=>'User','update'=>'UserInfoDiv'));
$ajax->form('edit','post',array('model'=>'User','update'=>'UserInfoDiv'));
$ajax->form(array('type' => 'post',
'options' => array(
'model'=>'User',
'update'=>'UserInfoDiv',
'url' => array(
'controller' => 'comments',
'action' => 'edit'
)
)
));
$ajax->form(array('type' => 'post','options' => array('model'=>'User','update'=>'UserInfoDiv','url' => array('controller' => 'comments','action' => 'edit'))));
You should not use the $ajax->form() and $ajax->submit() in the same form. If you want the form validation to work properly use the $ajax->submit() method as shown below.


























