DBookatay Posted March 5, 2007 Share Posted March 5, 2007 I have an application form on my site that requires users to insert information, to apply for credit. I am trying to make a script that shows a hidden layer, named "Previous" if the user selects "01" or "0" from a select box nammed "ap_add5". Which basically means that if the person filling out the form has lived at their current address for less than 2 years a layer showing "Previous Address" fields will appear. Can anyone help with this? Quote Link to comment Share on other sites More sharing options...
fenway Posted March 5, 2007 Share Posted March 5, 2007 Sure... use an onchange handler to trigger a change in the display attribute of your DIVs which contain the other "layers". Quote Link to comment Share on other sites More sharing options...
nogray Posted March 5, 2007 Share Posted March 5, 2007 as "fenway" said, something like this <script language="javascript"> function show_hide(val){ if ((val == "0") || (val == "1")) document.getElementById('pre_address_div').style.display = ""; else document.getElementById('pre_address_div').style.display = "none"; } </script> <select onchange="show_hide(this.value);"> <option value="">Select</option> <option value="0">Less than one year</option> <option value="1">One Year</option> <option value="2">Two Years</option> <option value="3">More than two years</option> </select> <div id="pre_address_div" style="display:none;"> Previous address fields </div> Quote Link to comment Share on other sites More sharing options...
DBookatay Posted March 6, 2007 Author Share Posted March 6, 2007 Thanks guys, this does exactly what I was trying to accomplish!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.