Validation stopped working
Hi there -
the validation on my page has stopped working - the form is displayed as a modal - then submitted to a php page for the db entry part
Here is the javascript part
-
<script type='text/javascript' src='/ontime/js/jquery.validate.js'></script>
<script type="text/javascript">
function valid_address() {
$("#addressValidateEng").validate({
rules: {
company: "required",
contact: "required",
tel: "required",
},
messages: {
company: "X",
contact: "X",
tel: "X",
},
errorPlacement: function(error, element) {
if ( element.is(":radio") )
error.appendTo( element.parent().next().next() );
else if ( element.is(":checkbox") )
error.appendTo ( element.next() );
else
error.appendTo( element.parent().next() );
},
// specifying a submitHandler to prevent the default submit
submitHandler: function(form) {
form.submit();
},
});
}
</script>
And here is the form -
-
<form id="addressValidateEng" action="/ontime/includes/addressEng.inc.php" method="post" >
<input type="hidden" name="recordId" value="<?php echo $recordId;?>" />
<div style="float:left;width:330px;">
<div style="float:left; padding-top:4px; margin-right:10px; width:100px;">company*:</div>
<div style="float:left"><input type="text" name="company" id="company" style="width: 180px;float:left;display:inline;" class="adresse-input" value="<?php echo $records[0]->getField('company') ?>" /></div> <br clear ="all"/>
<div style="float:left; padding-top:4px; margin-right:10px; width:100px;">contact*:</div>
<div style="float:left"><input type="text" name="contact" id="contact" style="width: 180px;float:left;display:inline;" class="adresse-input" value="<?php echo $records[0]->getField('contact') ?>" /></div> <br clear ="all"/>
<div style="float:left; padding-top:4px; margin-right:10px; width:100px;">Tel*:</div>
<div style="float:left"><input type="text" name="tel" id="tel" style="width: 180px;float:left;display:inline;" class="adresse-input" value="<?php echo $records[0]->getField('Tel') ?>" /></div> <br clear ="all"/>
</div>
<a class="button modalAdrEdit" href="#" onclick="valid_address()"><span>Modify Address</span></a>
<br clear="all" />
</form>
The form submits, and updates the originating page - but no validation takes place
Any help greatly appreciated -
Glorifindal