I have the following files:
1. a PHP page that is loaded first and includes a number of functions. It calls a couple of other pages:
1a. a template file that has the following function in the head:
function checkForm( what )
{
var ret = false;
if( isBlank( document.getElementById('firstname') ) ) {
alert( 'You must enter your first name' );
} else if( isBlank( document.getElementById('surname') ) ) {
alert( 'You must enter your last name' );
} else if( isBlank( document.getElementById('agency') ) ) {
alert( 'You must enter your school or agency' );
} else if( isBlank( document.getElementById('email') ) ) {
alert( 'You must enter your e-mail address' );
} else if( !isBlank( document.getElementById('partnerLast') && isBlank(document.getElementById('partM') ) ) {
alert( 'You must enter your partner\'s birthday' );
} else if( isBlank( document.getElementById('address1') ) ) {
alert( 'You must enter your mailing address' );
} else if( isBlank( document.getElementById('city') ) ) {
alert( 'You must enter your city' );
} else if( isBlank( document.getElementById('pcode') ) ) {
alert( 'You must enter your postal code' );
} else if( isBlank( document.getElementById('acode') ) || isBlank( document.getElementById('tela') ) || isBlank( document.getElementById('telb') ) ) {
alert( 'You must enter your telephone number' );
} else if( checkGroup(what.category) == null ) {
alert( 'You must select a category' );
} else {
ret = true;
}
return ret;
}
1b: a php file that represents step one of a four part form.
In the file from 1b, I have the following code:
function so_FormRow( $text, $required, $name, $size, $verify = null ) {
$ret = '<tr><td style="text-align: right;">';
if( $required ) {
$ret .= '<span class="required">*</span> ';
}
$ret .= $text;
$ret .= '</td><td><input ';
if( $verify != null ) {
$ret .= 'onblur="'.$verify.'(this);" ';
}
$ret .= 'name="'.$name.'" class="entryFormFields" id="'.$name.'" size="'.$size.'"';
if( isset( $_COOKIE['naa'][$name] ) ) {
$ret .= ' value="'.$_COOKIE['naa'][$name].'"';
}
$ret .= '></td></tr>';
return $ret;
}
and
<form method="post" onSubmit="return checkForm(this);">
<table width="500" border="0" cellpadding="3" class="entryform">
<tr class="miniheading">
<td colspan="2" class="boldbody" style="padding: 3px;">Your Information</td>
</tr>
EOF;
$ccContent .= so_FormRow( "First Name", true, 'firstname', 30, 'checkBlank' ).
so_FormRow( "Last Name", true, 'surname', 30, 'checkBlank' ).
so_FormRow( "School/Agency", true, 'agency', 30, 'checkBlank' ).
so_FormRow( "Province", true, 'prov', 30, 'checkBlank' ).
'<tr><td style="text-align: right; vertical-align: top;"><span class="required">*</span> Birthday</td>'.
'<td>'.
so_Months( "entM" ).' '.so_Days( "entD" ).' '.so_Years( "entY" ).
'<br/><span class="mainbody2"></span>'.
'</td></tr>'.
so_FormRow( "E-mail Address", true, 'email', 30 ).
"<tr class=\"miniheading\"><td colspan=\"2\" style=\"padding: 3px;\">Your Partner's Information (if applicable)</td></tr>".
so_FormRow( "Partner's First Name", false, 'partnerFirst', 30 ).
so_FormRow( "Partner's Last Name", false, 'partnerLast', 30 ).
so_FormRow( "School or Agency", false, 'partnerAgency', 30 ).
so_FormRow( "Province", false, 'partnerProv', 30 ).
"<tr><td style=\"text-align: right; vertical-align: top;\"><span class=\"required\">*</span> Partner's Birthday</td>".
'<td>'.
so_Months( "partM" ).' '.so_Days( "partD" ).' '.so_Years( "partY" ).
'<br/><span class="mainbody2"></span>'.
so_FormRow( "Email", false, 'partnerEmail', 30 );
$ccContent .= <<<EOF
So, what is supposed to happen is that when one of the form fields in this section is not filled out, an alert window is supposed to come up. This used to work but I moved to a new server, and of course, now it does not. I have looked at this for a while now but can't seem to find it so perhaps a fresh pair of eyes will see it.
I appreciate the help.
Dave