Hi I have found the below script that works for me to show/hide a text field when an option is selected. However, I want to make sure that the value entered in the text field is capture and post when the form is submitted. How do I do that? Thanks.
HTML Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <script language="JavaScript" type="text/javascript"> function ShowTB(obj,id){ txt=obj.options[obj.selectedIndex].text; if (txt.match('other')){ document.getElementById(id).style.visibility='visible'; } else{ document.getElementById(id).style.visibility='hidden'; } } </script> </head> <body> <select onchange="ShowTB(this,'fred');" > <option >tom</option> <option >dick</option> <option >smith</option> <option >other</option> </select> <br> <input id="fred" style="visibility:hidden;" > </body> </html>


Reply With Quote
Bookmarks