The short answer to your question is 'Yes', of course you can, and use 
javascript (probably best done with JQuery library) will give the best user 
experience although some might say Flash or Flex will do it better.

In any case, using javascript, in principle, you have a number (10 in your 
case) hidden divs on the page within a form.  You build a 'state engine' in 
javascript that validates the response to each question when the user clicks on 
'next', then displays the appropriate next div.
Jquery can do this for you whilst not cluttering your html with lots of 
embedded javascript (on button clicks etc.)
Using this technique you dont have to send the page to the server and have it 
refresh on every question, which might be the case if you chose to do the thing 
in CF alone.
Another possibility is to use Ajax (or use it in conjunction with JQuery.)

I cant say which is best, but using Javascript by itself without Jquery will 
get you some complex and convoluted code I suspect.  Simple code that is easy 
to follow is better.

At the end you just submit the page to whatever Cold fusion backend code you 
have to process/store/respond to the overall form (or send it to the server 
using ajax if you like). 

IHTH
Cheers
....
>Hi
>
>I am trying to create a web form with conditional form fields and was
>wondering the best way to do this with CSS and javascript?
>
>I am trying to get the form so when a user clicks 'yes' on question 1 it
>will show question 2, if they click no it will display the text 'please
>call 5555'
>
>The same goes for question 2 if a user clicks on 'yes' it will then
>display question 3 and the relevant form fields and so on up to question
>10.
>
>Is this possible with CSS and Javascript and what is the best way of
>doing this?
>
>TIA 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333413
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to