Skip to main content
Known Participant
April 1, 2009
Question

Dependant Form Fields (CF8)

  • April 1, 2009
  • 2 replies
  • 1522 views
We have recently upgraded to coldfusion 8 and I'm looking to do a little more with my online forms, to make them easier for the end user.

The first feature I'd like to tackle is displaying some form fields, conditional to the input on another field.

i.e. Do you have a car? Yes [ ] No [ ]

IF the user selects yes another form field shows up, which was previously hidden.

i.e. What car do you have?

I've have got this to work using CFWINDOW which is far from ideal, but i'm sure there must be a better way.

Thanks in advance for your help.
    This topic has been closed for replies.

    2 replies

    Sam_HamAuthor
    Known Participant
    April 2, 2009
    That you both for yout advice.

    cfwild I can see the advantages of using dependant dropdown boxes, but unfortunately on this occassion it will not be suitable for my form.

    I'd do a bit more research and post my findings here. I'm hoping to incorporate AJAX submission with the form also.

    Sam.
    April 2, 2009
    Hi,

    One approach that works well is to create a group of cfselect boxes. Populate the first select with possible answers to your first question. When that question is answered, you can pass that answer as an argument to the next cfselect (via a bind). There are quite a few articles on this out on google.

    cfwild
    Inspiring
    April 2, 2009
    Unfortunately I think the best solution is to use JavaScript and not CF.