User Tools

Site Tools


lr-includeexample

Lead Routing Required field checking

There are 2 defined methods in this JavaScript include file:

  • function initSetup()
    • this method sets up the Country drop down box to call the method to map the State/Provinces for the Country selected every time a new Country is selected
  • function checkRequired()
    • this method checks to make sure the required fields have values in them before the form data can be saved or displayed to the user
<script>
function initSetup() {
    if ($('theater_id').value > 0) {
        theaterChange($('theater_id').value, true);
    }
}
function checkRequired() {
	var msg = '';
	if( $('company').value == '' ) {
		msg+= '- Please enter a Company Name\n';
	}
	if( $('contact').value == '' ) {
		msg+= '- Please enter a Contact\n';
	}
	if( $('email').value == '' ) {
		msg+= '- Please enter an E-mail Address\n';
	}
	if( $('phone1').value == '' ) {
		msg+= '- Please enter a Phone Number\n';
	}
        if( $('countryCode').value == '' ) {
		msg+= '- Please select a Country\n';
	}
	if(msg.length > 0) {
		alert('The following issues were found...\n\n'+msg);
		return false;
	} else {
		$('editForm').submit();
	}
}
</script>
lr-includeexample.txt · Last modified: 2009/05/28 14:47 by bradley