|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Dynamic form content in ColdFusion
I have an HTML form in a ColdFusion page. The form uses the
method=POST to send information to a database upon submission. Is there any way to have ColdFusion display certain elements of the form based on previous selections (but before the form is submitted). For example, the form collects the standard info -- name, email, phone, and then asks to select one from a set of radio buttons, with options like 'Book', 'Magazine', 'CD', 'DVD'. What I would like to do, is have different parts of the form appear (or maybe just enabled) depending on which radio button you pick. So, if you choose 'Book', the form will expand to include fields you need to enter such as 'Author', 'ISBN', etc. And if you choose 'CD', you'll then be asked to enter 'Composer/Band', 'CD Title', etc. And so on. I realize that I could do this with a series of forms, so that you select 'Book', submit that and then get sent to a different form, but for various reasons I would like it all encapsulated in one ColdFusion document. The problem, of course, is that until the form is submitted I can't figure out how ColdFusion know what you've selected. Is there some onClick technique I can use or something? I realize that I could do this with DHTML, but I'd rather not deal with the issues involved...Thanks! |
|
#2
|
|||
|
|||
|
The only way to do this (without making a request to the server as you mentioned) is to use Javascript and DHTML to enable or make visible the appropriate parts of the form. CF only works on the server side and has no control over the client-side browser behavior aside from it's ability to generate dynamic Javascript to send the user along with the page.
You might look at the QForms Javascript API which does a number of these sorts of things and plays quite nicely with CF. http://www.pengoworks.com This could also be done with Flash of course.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Dynamic form content in ColdFusion |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|