AndyL
07-20-2004, 03:16 PM
Hi there,
I have a form in which I would like the first question [a 'Yes'/'No' radio button option] to dictate whether more of a form should be shown or not.
Currently I am putting the 'Yes'/'No' radio button option in 'form1' and the remainder of the form in 'form2' but I would prefer to have it all in one form to be submitted in PHP/mySQL query [I'm OK on this part!].
Is this possible?
At present the 'Yes' option is 'CHECKED' by default and a 'Submit' button appears immediately beneath it. If the user selects the 'No' option I would like the user to see the 'Submit' button disappear & IN IT'S PLACE [i.e over the top of it - using layers?!?!?] the remainder of the form appear, seamlessly. A 2nd 'Submit' button then appears at the end of the form.
[/CODE]
<HTML>
<HEAD>
<TITLE>Claim Notification Form</TITLE>
</HEAD>
<SCRIPT TYPE=text/javascript>
// _w : which ID (1) or (2)
// _h : (h)ide or (s)how
function toggleT(_w,_h)
{
if (document.all)
{ // is IE
if (_h=='s') eval("document.all."+_w+".style.visibility='visible';");
if (_h=='h') eval("document.all."+_w+".style.visibility='hidden';");
}
else
{ // is NS?
if (_h=='s') eval("document.layers['"+_w+"'].visibility='show';");
if (_h=='h') eval("document.layers['"+_w+"'].visibility='hide';");
}
}
</SCRIPT>
<BODY>
<FORM>
<TABLE BORDER=1 WIDTH=80%>
<TR><TD ALIGN=CENTER COLSPAN=4><H3><FONT COLOR=RED>To avoid delay, please complete <U>all</U> sections of the form</FONT></H></TD></TR>
<TR><TD COLSPAN=4><B>Nil Returns:</B></TD></TR>
<TR><TD>Please indicate whether a Nil Return</TD><TD><INPUT type="radio" name="Nil_Return" VALUE="Yes" CHECKED onClick="toggleT('divtag1','h')"> Yes <INPUT type="radio" name="Nil_Return" VALUE="No" onClick="toggleT('divtag1','s')"> No</TD></TR>
<TR><TD ALIGN=CENTER COLSPAN=4><INPUT TYPE=SUBMIT VALUE="Submit Request" TITLE="Click to submit the request" STYLE="color:white; background-color:#6666CC"></TD></TR>
</TABLE>
</FORM>
<SPAN ID="divtag1" STYLE="visibility:hidden;position:relative;top:0;left:0">
<FORM METHOD="POST" NAME="myForm" onSubmit="return checkForm(this);">
<TABLE BORDER=1 WIDTH=80%>
<TR><TD COLSPAN=4><B>Insured Details:</B></TD></TR>
<TR><TD>Name</TD><TD COLSPAN=3><INPUT name="Name" SIZE=30 VALUE="<?PHP echo $name?>"></TD></TR>
<TR><TD>Extension</TD><TD SIZE=10><INPUT name="Extension" SIZE=5 VALUE="<?PHP echo $extension?>"></TD></TR>
<TR><TD>Room Number</TD><TD><INPUT name="Room_Number" SIZE=5 VALUE="<?PHP echo $location?>"></TD></TR>
</TABLE>
</FORM>
</BODY>
</HTML>
[/CODE]
Many thanks,
Andy
I have a form in which I would like the first question [a 'Yes'/'No' radio button option] to dictate whether more of a form should be shown or not.
Currently I am putting the 'Yes'/'No' radio button option in 'form1' and the remainder of the form in 'form2' but I would prefer to have it all in one form to be submitted in PHP/mySQL query [I'm OK on this part!].
Is this possible?
At present the 'Yes' option is 'CHECKED' by default and a 'Submit' button appears immediately beneath it. If the user selects the 'No' option I would like the user to see the 'Submit' button disappear & IN IT'S PLACE [i.e over the top of it - using layers?!?!?] the remainder of the form appear, seamlessly. A 2nd 'Submit' button then appears at the end of the form.
[/CODE]
<HTML>
<HEAD>
<TITLE>Claim Notification Form</TITLE>
</HEAD>
<SCRIPT TYPE=text/javascript>
// _w : which ID (1) or (2)
// _h : (h)ide or (s)how
function toggleT(_w,_h)
{
if (document.all)
{ // is IE
if (_h=='s') eval("document.all."+_w+".style.visibility='visible';");
if (_h=='h') eval("document.all."+_w+".style.visibility='hidden';");
}
else
{ // is NS?
if (_h=='s') eval("document.layers['"+_w+"'].visibility='show';");
if (_h=='h') eval("document.layers['"+_w+"'].visibility='hide';");
}
}
</SCRIPT>
<BODY>
<FORM>
<TABLE BORDER=1 WIDTH=80%>
<TR><TD ALIGN=CENTER COLSPAN=4><H3><FONT COLOR=RED>To avoid delay, please complete <U>all</U> sections of the form</FONT></H></TD></TR>
<TR><TD COLSPAN=4><B>Nil Returns:</B></TD></TR>
<TR><TD>Please indicate whether a Nil Return</TD><TD><INPUT type="radio" name="Nil_Return" VALUE="Yes" CHECKED onClick="toggleT('divtag1','h')"> Yes <INPUT type="radio" name="Nil_Return" VALUE="No" onClick="toggleT('divtag1','s')"> No</TD></TR>
<TR><TD ALIGN=CENTER COLSPAN=4><INPUT TYPE=SUBMIT VALUE="Submit Request" TITLE="Click to submit the request" STYLE="color:white; background-color:#6666CC"></TD></TR>
</TABLE>
</FORM>
<SPAN ID="divtag1" STYLE="visibility:hidden;position:relative;top:0;left:0">
<FORM METHOD="POST" NAME="myForm" onSubmit="return checkForm(this);">
<TABLE BORDER=1 WIDTH=80%>
<TR><TD COLSPAN=4><B>Insured Details:</B></TD></TR>
<TR><TD>Name</TD><TD COLSPAN=3><INPUT name="Name" SIZE=30 VALUE="<?PHP echo $name?>"></TD></TR>
<TR><TD>Extension</TD><TD SIZE=10><INPUT name="Extension" SIZE=5 VALUE="<?PHP echo $extension?>"></TD></TR>
<TR><TD>Room Number</TD><TD><INPUT name="Room_Number" SIZE=5 VALUE="<?PHP echo $location?>"></TD></TR>
</TABLE>
</FORM>
</BODY>
</HTML>
[/CODE]
Many thanks,
Andy