I am using jQuery and cakephp for my application.
I have a form created on my page using $form->create. The form contains many fields that the user will fill out and submit; data is saved
function submit($id = null)
{
foreach ($_POST as $key => $value):
$this->data['Result']['form_id']=$id;
$this->data['Result']['label']=$key;
$this->data['Result']['value']=$value;
endforeach;
$this->Session->setFlash('Your entry has been submitted.');
}
Now I want to perform checks in the form, like all the filled field values. If it is not completed, it should show a warning or message asking to fill in the appropriate field. How to do it?
Another suggestion is needed: which would be better, client-side or server-side validation?
source
share