Skip to main content
Inspiring
April 16, 2007
Question

allow multiple selections in 2nd box of cf_TwoSelectsRelated

  • April 16, 2007
  • 1 reply
  • 652 views
Greetings. I'm very new to ColdFusion, so I apologize if this seems like a no-brainer.

I've successfully used cf_TwoSelectsRelated to add related selects to a form. I'm able to have a user select a school, and have the second select box retrieve only the teachers that are from that school. Now I'd like to allow multiple teachers to be selected from the second list (to register for a workshop) and have them all be inserted in my registration table as individual records.

I think I can figure out the second part of my task (insert them as individual records) based on Dan Bracuk's answer to a query back in February. However, for the first part (allow multiple selections in the second select list) I'm not sure whether to:
a) try to edit the cf_TwoSelectsRelated custom tag (I think I would need to know some JavaScript for that? yipe!)
or
b) do something to my existing code to allow the second select to have multiple selections (but doesn't cf_select just require that you specify in the attributes "multiple="true"? which means I will probably need to edit the cf_TwoSelectsRelated custom tag (back to *yipe*!)

Can anyone point me in the right direction? I've attached cf_TwoSelectsRelated. Please let me know if you need me to supply my code.
Thanks very much in advance.
Marianne
    This topic has been closed for replies.

    1 reply

    Inspiring
    April 16, 2007
    Try the easiest thing first. Allow mulitlple selections in your second select and run the page. Make some selections from the 1st select and see if the 2nd one populates correctly.

    It might actually work.
    Inspiring
    April 16, 2007
    Dear Dan,

    Thanks for this! Well, I went ahead and kept trying to figure it out while I waited - I found and took a look at cf_ThreeSelectsRelated and the third select box did indeed have a "multiple" attribute - so I borrowed it and edited the cf_TwoSelectsRelated (as attached - just added one line to the attributes list and added one cfif to the cfoutput for the 2nd select box), called it in the attributes of the cf_TwoSelectsRelated tag call in my "add attendees" page - and it seems to work great! No messing about with scary javascript needed. *whew*
    Now I just have to edit the code to allow it to insert each set of id's as an individual record... but I think I can handle that :)
    Hopefully this will help someone who's wondering if this will work. I couldn't find any reference to it anywhere!
    praveenk66545875
    Participant
    July 16, 2015

    I cant find the attachment, can I have the code which you have added please ?