10-30-2009, 05:17 PM
|
#2 (permalink)
|
|
The Visitor
Join Date: Oct 2009
Location: Richmond VA
Posts: 1
Thanks: 0
|
RE: Building Javascript PHP problem
captainmerton,
Javascript is not happy with line breaks.
I took your posted PHP output, made each JS statement contained on a single line, added an onBlur="inviteFormVerifyMe();" for Email and retypeemail form fields, and it workded lile a champ.
Below is the code that works.
Scot L. Diddle, Richmond VA
Code:
<script language='javascript'>
function inviteFormVerifyMe(){
var msg='';
if(document.getElementById('email').value=='') {
msg+='- Email';
}
if(document.getElementById('retypeemail').value=='') {
msg+='- Retype Email';}if(msg!='') {
alert('The following fields are empty or invalid:'+msg);
return false
}
else{
return true
}
}
</script>
<form name="HiMom" id="HiMom" action="<?php echo $_SERVER['PHP_SELF'] ?>" >
<input onBlur="inviteFormVerifyMe();" type="text" name='Email' id="Email>"> Email<br />
<input onBlur="inviteFormVerifyMe();"type="text" name='retypeemail' id="retypeemail>"> Re-Type Email<br />
</form>
|
|
|
|