Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms (Conditional?)

Status
Not open for further replies.

stevemarsh99

Technical User
Aug 10, 2005
88
GB
Hey all, Im new to the forum! Just a starting question, where can I find some nice examples of code that I can use for conditional forms. What I mean by that is this - when your filling out a form and then what you fill in at the top determines what options you have down the form later?

What is this called and where can I find some examples?

Thanks
Steve
 
You're looking at using DHTML or a dynamic page (asp, php, jps, etc). With DHTML you just put it all the potential sections and organise them into say tables.
Then: attach a respective event to your input controls when they change.
Then set the style.display = "none"; or style.display = "inline"; (or "block") that's to hide/show a section.

When the form is submitted you'll still get all the hidden fields but you can set their value to say __EMPTY__ with the script.

Do some gooling on document.getElementById
 
I had a go at googling the string your asked me to and didnt really understand the results! Im not really a javascript man, more of a humble asp prodder!

Anyways does no-one know where I can get a neat example of this form? That way I should rip it to bits and use what is needed?
 
I am trying to do the following and I am really struggling.

I would like a form that posts the following into a database (which I can do, thats fine) Its just the conditional show or hife values thats confusing me:

Name ___________
Jobtitle___________

Industry [ Drop down ]

#########
values:
construction
Rental
Industrial
#########

and when you select one of those three you get other drop downs that habe relevant questions to the results you picked.

Then all these entries have to go into a database?

I ideas (there must be a Javascript genius out there!)
 
>there must be a Javascript genius out there
There must be...

So you're waiting for some genius to write the script for you? Even genius needs time to write thing down. But, does the script help you to understand what is going on?

Upon waiting... maybe you can learn something too for a change.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top