hello everybody,
I'm not the best at javascript so i though i put the problem here and see what i get. I only copy/pasted part of the code with the problem so to not to confuse the problem.
problem:
bassically when the the user hits the submit button the function formvalidation(thisform)is called. everything in the formvalidation() works except the function doYes()!
the doYes() funtion verifys weather the user selected(radio) yes or no to the agreement.
the doYes() function is called from within formvalidation to keep the code clean but i have a feeling the way i'm sending which radio button was sellected isn't being carried over into the formvalidation() function.
problem areas are indicated by the colorred.
any help u can give me would be greatly appreciated.
function doYes(enter = arg[0].checked, alertbox)
{ if (entry === true)
{ return ture; }
else
{ alert(alertbox);
return false;
}
}
function formvalidation(thisform)
{ with (form1)
{ if (emailvalidation(Email,"Illegal E-mail")==false) {Email.focus(); return false;};
if (emptyvalidation(field_three,"The textfield is empty")==false) {field_three.focus(); return false;};
if (doYes(arg[0].checked,"Sorry - you must sign agreement before sending form")==false) {submit_button.focus(); return false;};
popUp("confirm.html");
return true;
}
}
</script>';
echo '</head>';
echo '<body bgcolor="#CCCCCC" text="#993300">';
echo '<div align="center"> <label> <font size="6">How to save user information</font> </label> </div>';
echo '<form name="form1" action="'.$_SERVER['PHP_SELF'].'" method="post" onsubmit="return formvalidation(this)" >';
echo '<p align="center"> <font size="5">Field 1 ==>:</font>
<input name="Email" type="text" size="30" value="" ></p>';
echo '<p align="center"> <font size="5">Field 2 ==>:</font>
<input name="field_two" type="text" id="Field_two" size="30"> </p>';
echo '<p align="center"> <font size="5">Field 3 ==>:</font>
<input name="field_three" type="text" size="30" > </p>';
echo' <textarea name="agreement_text" cols="70" rows="5" id="agreement_text">test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement </textarea>
<br>I have read and accept this agreement
<input name="agr" type="radio">Yes
<input name="agr" type="radio" checked="checked">No';
echo '<p align="center"> <input name="submit_button" type="submit" id="Submit_button" value="Save button">
<input name="Reset_button" type="reset" id="Reset_button" value="Reset"> </p>';
echo '</form>';
I'm not the best at javascript so i though i put the problem here and see what i get. I only copy/pasted part of the code with the problem so to not to confuse the problem.
problem:
bassically when the the user hits the submit button the function formvalidation(thisform)is called. everything in the formvalidation() works except the function doYes()!
the doYes() funtion verifys weather the user selected(radio) yes or no to the agreement.
the doYes() function is called from within formvalidation to keep the code clean but i have a feeling the way i'm sending which radio button was sellected isn't being carried over into the formvalidation() function.
problem areas are indicated by the colorred.
any help u can give me would be greatly appreciated.
function doYes(enter = arg[0].checked, alertbox)
{ if (entry === true)
{ return ture; }
else
{ alert(alertbox);
return false;
}
}
function formvalidation(thisform)
{ with (form1)
{ if (emailvalidation(Email,"Illegal E-mail")==false) {Email.focus(); return false;};
if (emptyvalidation(field_three,"The textfield is empty")==false) {field_three.focus(); return false;};
if (doYes(arg[0].checked,"Sorry - you must sign agreement before sending form")==false) {submit_button.focus(); return false;};
popUp("confirm.html");
return true;
}
}
</script>';
echo '</head>';
echo '<body bgcolor="#CCCCCC" text="#993300">';
echo '<div align="center"> <label> <font size="6">How to save user information</font> </label> </div>';
echo '<form name="form1" action="'.$_SERVER['PHP_SELF'].'" method="post" onsubmit="return formvalidation(this)" >';
echo '<p align="center"> <font size="5">Field 1 ==>:</font>
<input name="Email" type="text" size="30" value="" ></p>';
echo '<p align="center"> <font size="5">Field 2 ==>:</font>
<input name="field_two" type="text" id="Field_two" size="30"> </p>';
echo '<p align="center"> <font size="5">Field 3 ==>:</font>
<input name="field_three" type="text" size="30" > </p>';
echo' <textarea name="agreement_text" cols="70" rows="5" id="agreement_text">test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement test agreement
test agreement test agreement test agreement test agreement test agreement test agreement test agreement </textarea>
<br>I have read and accept this agreement
<input name="agr" type="radio">Yes
<input name="agr" type="radio" checked="checked">No';
echo '<p align="center"> <input name="submit_button" type="submit" id="Submit_button" value="Save button">
<input name="Reset_button" type="reset" id="Reset_button" value="Reset"> </p>';
echo '</form>';