Although the forms have different names, one of the scripts overrides the other and validates both. They have the same onsubmit, and one has a unique name (contact) and I cannot see why it is affecting the others search form which doesnt have a name.
Expand|Select|Wrap|Line Numbers
- onsubmit="return validate_form(this)"
Expand|Select|Wrap|Line Numbers
- function validate_required(field,alerttxt)
- {
- with (field)
- {
- if (value==null||value=="")
- {alert(alerttxt);return false}
- else {return true}
- }
- }function validate_form(thisform)
- {
- with (thisform)
- {
- if (validate_required(SearchWord,"Please enter a value for the \"search word\" field!")==false)
- {SearchWord.focus();return false}
- }
- }
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript">
- <!--
- function validate_form ( )
- {
- valid = true;
- if ( document.contact.ToName.value == "" )
- {
- alert ( "Please fill in the 'Recipients Name." );
- valid = false;
- }
- if ( document.contact.ToEmail.value == "" )
- {
- alert ( "Please fill in the 'Recipients Email' box." );
- valid = false;
- }
- if ( document.contact.FromName.value == "" )
- {
- alert ( "Please fill in the 'Your Full Name' box." );
- valid = false;
- }
- if ( document.contact.FromEmail.value == "" )
- {
- alert ( "Please fill in the 'Your Email' box." );
- valid = false;
- }
- return valid;
- }
- //-->
- </script>
How do I make them with unique so one does not override the other. At the moment the search validation comes up with enter the correct email,name,etc. It should just say enter a search term.
Any help would be greatly appreciated.
Thanks
Richard