roberts78 Posted August 8, 2009 Share Posted August 8, 2009 I have a form that has a dropdown menu. I cant figure out how to set a condition so that when 'Other' is checked it displays a hidden text box to fill out. But when any other selection is chosen it does not show it. Any ideas and Thanks again. <OPTION VALUE="0" SELECTED>--- Please Select ---</OPTION> <OPTION VALUE="1">Option 1</OPTION> <OPTION VALUE="2">Option 2</OPTION> <OPTION VALUE="3">Option 3</OPTION> <OPTION VALUE="4">Other</OPTION> Link to comment https://forums.phpfreaks.com/topic/169397-solved-showing-hidden-text-box-when-condition-is-met/ Share on other sites More sharing options...
Psycho Posted August 9, 2009 Share Posted August 9, 2009 <html> <head> <script type="text/javascript"> function showField(fieldID, showBool) { document.getElementById(fieldID).style.visibility = (showBool) ? '' : 'hidden'; } </script> </head> <body> <select name="something" onchange="showField('other', this.value=='4');"> <option value="0" selected="selected">--- Please Select ---</option> <option value="1">option 1</option> <option value="2">option 2</option> <option value="3">option 3</option> <option value="4">Other</option> </select><br /> <input type="text" name="other" id="other" style="visibility:hidden;" /> </body> </html> Link to comment https://forums.phpfreaks.com/topic/169397-solved-showing-hidden-text-box-when-condition-is-met/#findComment-894314 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.