Interactive forms using Javascript

Recommended Posts

I am currently developing some 'advanced HTML forms' for a clients site, the form needs to hide elements on the page dependant upon the user selection of previous fields.For instance, its for an Estate Agents - if the user wants to buy/rent/let a Bungalow, he or she select 'Bungalow' from the drop down menu.

The effect I want now is to hide elements below in the form which won't be relevant for a bungalow such as I have a question stating 'How many floors does the property have?' obviously a Bungalow will only have the one floor so this question would be need to be hidden from the user's view.

So, in this case the user selects 'Bungalow' from a drop-down menu, and it will hide the question 'How many floors does the property have?' along with its related drop-down menu from the screen.

Can anyone suggest how this would be done using javascript techniques?

*UPDATE*I found this which is kinda what i am looking for.. if anyone else finds anything similar please post to the board :)http://www.zimmertech.com/tutorials/web-design/22/interactive-hidden-forms-tutorial.php

Share this post

Link to post

Share on other sites

My javascript isnt the best though.. could you possibly illustrate this with an example or possibly post the full code here so I can view it. If you could do that I would much appreciative, kind thanks

Share on other sites

If user selects radio button 'YES' then hide a <div>, however if user selects radio button 'NO' then show the same <div>. By default I want the <div> hidden using the onload event.Can anyone explain how to do this, I think the heat is killing the brain cells today it feels like 50 degrees in this office! :(