Click to See Complete Forum and Search --> : Hide Show Input Field on Form


Mark Babb
04-18-2003, 09:47 AM
I have a drop down box that has options 1-8, basically asking how many passes are needed?

I created 8 input text boxes which are hidden. I would like to change the hidden to false, to correlate with the number of passes needed.

ie; if the user selects that they need 4 passes, then 4 of the input text boxes hidden attribute needs changed to false, so the user can enter a name and address.

Thanks
Mark

khalidali63
04-18-2003, 09:53 AM
Take a look at the link to show/hide form elements.
Example shows/hides check boxes just replace that with input fields,

now, make all of the input fields have the same name,this will create an array of input fields,getting the input from the user from select box

var len = parseInt(document.formName.listBox.options[document.formName.listBox.selectedIndex].value);

now make them visible

for(x=0;x<len;x++){
document.formName.inputFieldsName[x].style.visibility="visible";
}

hope this helps

:D

Mark Babb
04-18-2003, 10:04 AM
Originally posted by khalidali63
Take a look at the link to show/hide form elements.
Example shows/hides check boxes just replace that with input fields,

now, make all of the input fields have the same name,this will create an array of input fields,getting the input from the user from select box

var len = parseInt(document.formName.listBox.options[document.formName.listBox.selectedIndex].value);

now make them visible

for(x=0;x<len;x++){
document.formName.inputFieldsName[x].style.visibility="visible";
}

hope this helps

:D Did you say there was a link that had an example? I didn't see a link in your response. If you do great, if not that's fine.
Thanks
Mark

khalidali63
04-18-2003, 10:19 AM
oops..you'd need that wouldn't you..

http://68.145.35.86/skills/javascripts/ShowHideFormElement.html


:D

Mark Babb
04-18-2003, 11:59 AM
Originally posted by khalidali63
oops..you'd need that wouldn't you..

http://68.145.35.86/skills/javascripts/ShowHideFormElement.html


:D Thanks Khalid