Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FIELDSET tags and going "Back"

Status
Not open for further replies.

deerestp

MIS
Jan 18, 2002
1
US
Has anyone ever used the FIELDSET in conjunction with a checkbox and some javascript to "hide" fields? ... for example, if the checkbox is unchecked, the data doesn't show ... and if it's checked, it does. Well, I've got that park working fine.

The issue I'm having is if the person filling out the form advances to the next page and then has to go back to the previous page to change something. At that point, the FIELDSET tag isn't playing well. The checkbox is still checked, but the "hidden" fields aren't displayed ... they're hidden again. If you UNCHECK the checkbox, the fields come into view. I need for the data to be displayed if the box is checked ... any ideas? Perhaps some kind of javascript checking??

Thanks!!
~Michael

Here's a sample of my code ...

Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>

<html>
<head>
	<title>Untitled</title>
	
<style>
.hidden
{
	TEXT-DECORATION: none;
	COLOR: #000000;
	DISPLAY: none
</style>
	
<SCRIPT language=javascript>
<!--
function addDNS() {
var add_DNS = document.all.ADD_DNS
if (add_DNS.style.display == 'block'){
add_DNS.style.display='none'
}
else
add_DNS.style.display='block'
}
--></SCRIPT>

</head>

<body>


<FIELDSET style=&quot;width: 95%&quot;><LEGEND>WHAT DO YOU WANT TO DO?</LEGEND>
<TABLE cellSpacing=0 cellPadding=0 border=0><TBODY>
	<TR>
		<TD>
		 	<INPUT TYPE=&quot;checkbox&quot; NAME=&quot;WHICH_FORM&quot; VALUE=&quot;ADD_DNS&quot; onClick=&quot;addDNS();&quot;>
				Add a new DNS entry<BR>
		</TD>
	</TR>
</TBODY></TABLE>


<FIELDSET class=hidden id=ADD_DNS style?padding-right:100? style=&quot;width: 95%&quot;>
<LEGEND>WHAT TYPE OF DNS ENTRY DO YOU WANT TO CREATE?</LEGEND>
<TABLE><TBODY>
	<TR>
		<TD>
				<INPUT TYPE=&quot;checkbox&quot; NAME=&quot;ADD_DNS_RECORD&quot; VALUE=&quot;New_DNS_Name&quot; onClick=&quot;NewDNS();&quot;>New DNS Name<BR>
				<INPUT TYPE=&quot;checkbox&quot; NAME=&quot;ADD_DNS_RECORD&quot; VALUE=&quot;PTR_Only&quot; onClick=&quot;PTRDNS();&quot;>Reverse lookup (PTR record) for an existing DNS name<BR>
				<INPUT TYPE=&quot;checkbox&quot; NAME=&quot;ADD_DNS_RECORD&quot; VALUE=&quot;CNAME&quot; onClick=&quot;ALIAS();&quot;>Alias (CNAME record) for an existing DNS name<BR>
		</TD>
	</TR>
</TBODY></TABLE>
</FIELDSET>


</body>
</html>
 
What you have to do is check the state of the checkbox onFocus or onBlur, whichever works better. If it is checked, the related fieldset should be visible. If not, it should be hidden
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top