Richsparov
02-13-2003, 01:30 PM
I have a form. if the user selects radio button yes. it makes a div's style blocked so becomes visible.
If the user answers yes I want to force them to fill in the textarea in the newly visible div, and it don't work.
I have been trying to use v. simple function to validate
function validate(form){
r=1;
if (form.aQ1[0].checked==false && form.aQ1[1].checked==false)r=0;
if (form.aQ2[0].checked==false && form.aQ2[1].checked==false)r=0;
if ((form.aQ1[0].selected==true) && (form.aQ1a.length==0))r=0;
if ((form.aQ2[0].selected==true) && (form.aQ2a.length==0))r=0;
if (r==0) { alert('Please answer all questions'); return false; }
else { return true; }
}
but the form submits so long as i at least answer the first 2 lines.
I've checked my variable names and also tried form.aQ1a.value="" instead of form.aQ1a.length==0
any help gratefully recieved.
Thank you
If the user answers yes I want to force them to fill in the textarea in the newly visible div, and it don't work.
I have been trying to use v. simple function to validate
function validate(form){
r=1;
if (form.aQ1[0].checked==false && form.aQ1[1].checked==false)r=0;
if (form.aQ2[0].checked==false && form.aQ2[1].checked==false)r=0;
if ((form.aQ1[0].selected==true) && (form.aQ1a.length==0))r=0;
if ((form.aQ2[0].selected==true) && (form.aQ2a.length==0))r=0;
if (r==0) { alert('Please answer all questions'); return false; }
else { return true; }
}
but the form submits so long as i at least answer the first 2 lines.
I've checked my variable names and also tried form.aQ1a.value="" instead of form.aQ1a.length==0
any help gratefully recieved.
Thank you