1) There is a dropdown list with different options in it. (For example: 'Please Select' - which is the default followed by Choice 1, Choice 2).
2) When a user selects an option - let's say choice 1, it will first check if there are other 'special' fields (those that are displayed when called by the script) displayed and matches the value set in the HTML <option> tags before displaying the 'specific fields for that particular choice' (IE: by matching the ID name specify - ID="textlayer").
3) If a user choose any other option, the specific field for choice 1 will automatically hide (disappear from the form).
Here's the main code which does the job of displaying the specific fields...
(Where 'textlayer' is specify in the <tr> tags using ID="textlayer")
Hence, I would like to know, how is it possible to modify the code so that if Choice 1 is selected, it display the field that is meant for choice 1 and if it's Choice 2, displays field meant only for choice 2 and hides choice 1 field. And lastly, if it's the Default (EG: 'Please Choose One', it will not display anything).
Question
localhost
Hi all,
The following code works this way:
1) There is a dropdown list with different options in it. (For example: 'Please Select' - which is the default followed by Choice 1, Choice 2).
2) When a user selects an option - let's say choice 1, it will first check if there are other 'special' fields (those that are displayed when called by the script) displayed and matches the value set in the HTML <option> tags before displaying the 'specific fields for that particular choice' (IE: by matching the ID name specify - ID="textlayer").
3) If a user choose any other option, the specific field for choice 1 will automatically hide (disappear from the form).
Here's the main code which does the job of displaying the specific fields...
function showHide(divid) { divtag = eval(divid) if (divtag.style.display == "none" && document.shear_clear.clearance.value == "dieclr") { divtag.style.display = "block"; } else { if (divtag.style.display == "block") { divtag.style.display = "none"; } } }And the code that excutes to hide the specific field if other choice is selected:
In the form, I use this line to call the script:
onChange="java script:showHide('textlayer')"
(Where 'textlayer' is specify in the <tr> tags using ID="textlayer")
Hence, I would like to know, how is it possible to modify the code so that if Choice 1 is selected, it display the field that is meant for choice 1 and if it's Choice 2, displays field meant only for choice 2 and hides choice 1 field. And lastly, if it's the Default (EG: 'Please Choose One', it will not display anything).
I've tried on my own but doesn't work.
Thanks
Link to comment
Share on other sites
0 answers to this question
Recommended Posts