/* ============================================================= * "NewLead.html" * Updated: 27/09/01: Paul Cusch. Version 1.0 * Updated: 27/07/06: Paul Cusch. Version 1.1 * =============================================================  */ /* ============================================================= * Check that the mandatory fields have been filled in. If not then prompt  * the user. * ============================================================= */ ////////////////////////////////////////////////////////////// VALIDATE TEXT FIELD// Check that fields contain values:// return false if field contains null string// return true otherwise// return true if field is not found on the form////////////////////////////////////////////////////////////function validateTextField ( objField, strMessage ) {	if( objField ) { 		if ( objField.value == "" ) { 			alert ( strMessage )			objField.focus()			return false;		}	}	return true}////////////////////////////////////////////////////////////// VALIDATE SELECT FIELD (eg. drop down list)// Check that fields contain values:// return false if the null option is selected// return true otherwise// return true if field is not found on the form////////////////////////////////////////////////////////////function validateSelectField ( objField, strMessage ) { 	var intUserSelection	if ( objField ) {		intUserSelection = objField.selectedIndex		if ( objField.options[intUserSelection].value == "" ) {			alert ( strMessage )			objField.focus()			return false		}	}	return true}////////////////////////////////////////////////////////////// Validate the form////////////////////////////////////////////////////////////function validateForm( form ) { 	//	// Mandatory fields : Part 1: Normal text fields	//	var arrobjFields_Text = new Array ( 		form.ContactTitle,		form.ContactSurname,		form.ContactAddress,		form.ContactSuburb,		form.ContactState,		form.ContactPostcode,		form.ContactMobile	 )	var arrstrMessages_Text = new Array ( 		"Title: This field is required, please enter a value",		"Surname: This field is required, please enter a value",		"Postal Address: This field is required, please enter a value",		"Suburb: This field is required, please enter a value",		"State: This field is required, please enter a value",		"Postcode: This field is required, please enter a value",		"Email: This field is required, please enter a value"  )	//	// Mandatory fields : Part 2: Select fields	////	var arrobjFields_Select = new Array ( //		form.MemberContactAmend_EditPosition )//	var arrstrMessages_Select = new Array ( //		"Position: This field is required, please select an option" )	var Null_Found = false 	//	// check normal text fields for null 	//	for ( i=0; (i<arrobjFields_Text.length) && (!Null_Found) ; i++ ) {		if ( ! validateTextField ( arrobjFields_Text[i], arrstrMessages_Text[i] ) ) {			Null_Found = true 		}	}	//	// check select fields for null	////	for ( i=0; (i<arrobjFields_Select.length) && (!Null_Found) ; i++ ) {//		if ( ! validateSelectField ( arrobjFields_Select[i], arrstrMessages_Select[i] ) ) {//			Null_Found = true //		}//	}	//	// submit form	//	if (Null_Found) 	{			return false;	}	else		return true;}