Hi,
I am using Cakephp and JQuery in my application. I have created the form using
<?php
echo $form->create('Result',array('action'=>"submit/$formid"));
foreach ($viewfields as $r):
echo $form->input($r['Attribute']['label'], array('id'=>$r['Attribute']['id'],'name'=>$r['Attribute']['label'],'type'=>'text'));
endforeach;
echo $form->end('submit');?>
This will creates a Form with id for eg...ResultSubmit1Form where 1 is the formid
When i click on the submit button it submits the data correctly. But i want to add JQuery validations like none of the fields has to be empty .
I tried it with some examples But itt didnt works .How can i do so.....Please suggest me..
Edit:
I tried it with
$("#ResultSubmit/$formidForm").submit(function(event){
event.preventDefault();
/* do validation of fields */
if($("#"+<?=$r['Attribute']['id'];?>).fieldValue()==""){alert("Fill in "+"<?=$r['Attribute']['label'];?>");
$("#"+<?=$r['Attribute']['id'];?>).focus();
}
});
But nothing works ,this didnt enters into event at all..