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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making a hidden field visible based on a value 1

Status
Not open for further replies.

redbay

Technical User
Oct 13, 2003
145
GB
i have three hidden fields in my form that i would like to become visible when a user clicks pass to other, how should i do this please?
 
Well you would need to use either Javascript or VBscript. To run an IF statement.
 
Thanks, I've written the code and placed it below the code for the checkbox, the page opens but when i click the checkbox the field "PassedTo" does not become visible. Is my code correct or should i have placed it somewhere else??


If <input name="pass" type="checkbox" id="pass" value="checkbox"> = True Then

PassedTo = “Visible”

End If
 
Why not just put the textfield in a hidden layer and then show it when the checkbox is selected?

Cheech

[Peace][Pipe]
 
I tried to do that but the textfield is in an input form and it wouldnt input to the database
 
Thanks go to for the original script. This will toggle the visibility of the textfield called myText you could easily take out the if statement in the javascript so that you can only disply the field. I also added a line that reverts the value of the field to its original "Can you see me?" when it is hidden. as the value will still be passed when the form is submitted.
Code:
<script language="JavaScript">
	function doCheck(me){
		if (me.style.visibility=="hidden"){
			me.style.visibility="visible";
			}
		else {
			me.style.visibility="hidden";
			}
		}
</script>
<form name="form1" method="post" action="">
  <p>
    <input name="myText" type="text" value="Can you see me?" style="visibility:hidden">
</p>
  <p>  
    <input type="checkbox" name="myCheck" value="show" onClick="doCheck(myText)">
  </p>
</form>

Cheech

[Peace][Pipe]
 
Thanks Cheech - Yr a STAR again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top