I have put two snips of code I use in the body section of my page to
validate and submit two forms.
The first snip worked fine until I included the second...is the
problem the fact variables have the same name?
Cheers,
Chris
<script type="text/javascript">
var field1 = new LiveValidation( 'field1', {onlyOnSubmit: true } );
field1.add( Validate.Presence );
var mySelect1 = new LiveValidation('mySelect1');
mySelect1.add(Validate.Exclusion, { within: ['Please select...'],
failureMessage: "x"});
var automaticOnSubmit = field1.form.onsubmit;
field1.form.onsubmit = function(){
var valid = automaticOnSubmit();
...........
}
</script>
------------------------------------------------
<script type="text/javascript">
var field2 = new LiveValidation( 'field2', {onlyOnSubmit: true } );
field2.add( Validate.Presence );
var mySelect2 = new LiveValidation('mySelect2');
mySelect2.add(Validate.Exclusion, { within: ['Please select...'],
failureMessage: "x"});
var automaticOnSubmit = field1.form.onsubmit;
field2.form.onsubmit = function(){
var valid = automaticOnSubmit();
.............
}
</script>