jquery form validation

Feb 9, 2011 at 7:14 AM
Edited Feb 9, 2011 at 7:20 AM

Do you have a jquery plugin example in wish form validation is possible. Or do i have to create javascript without jquery myself?

Coordinator
Feb 9, 2011 at 6:52 PM

mdo:submit, mdo:ajax can accept js function name as validator:

<script type="text/javascript" 
  src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/jquery.validate.pack.js" />
  
<script type="text/javascript">
  function validateForm() {
    return $("form").validate().form();
  }
</script>

<div>Name: <input name="qqqq" class="required" /></div>
<div>E-Mail: <input name="aaaa" class="required email" /></div>

<a href="{mdo:jsubmit('validateForm', '@action', 'save')}">Save</a>

Validator must return false if errors occure, false otherwise.