Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    auto-select comboboxes

    i've searched everywhere but i cant quite find what im looking for i hope some1 here can help me...

    ok so im making two forms, one that contains mostly comboboxes and loads all its contents from different tables in an SQL db and when the user submits it send the information to an independant table. Another form that also contains mostly comboboxes (and some comboboxes are the same as the first form, only like 2) is supposed to have an "optional" combobox that when the user selects an option, all the comboboxes that are the same as the first form automatically select the same option as they chose on the first form. this is used to save time, i really dont get it since it's only 2 comboboxes but my tutor sais it has to be that way so...

    Anyway i know it's made with the "onchange event" on the optional combobox and that it could be done with a javascript but problem is i dont know js (i've been working the whole page with ASP in vb script), but i sorta understand it xD. Also the way this works is that the user is given an Event ID on the first form so when they go to the second form they just select the event id on the optional combobox and the combos are filled.

    So i hope some1 can point me the right way here, thanks in advance

  • #2
    New Coder
    Join Date
    Aug 2005
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's a good javascript tutorial for beginners.

    http://www.w3schools.com/js/default.asp

    What you'll have to do is have the asp write their answers from the first form into javascript variables. Then like your tutor said, have the one combobox with an onchange javascript function that loads the data from those variables into the form.

    Another way you could do it is without javascript. Just make it so the second form automatically posts back to itself when they change that one combobox. Then have the asp load the data when it sees the value of that combobox. I haven't done regular asp (I do asp.net now) in a while so I don't remember the code to do it, but that's the basic idea. Many might say this way would be preferable because then you wouldn't have to worry about people that have javascript disabled.

    Anyway, that's my two cents.

    Brett Bretterson

  • #3
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    Hi:
    As this thread is cross posted in the ASP forum (http://www.codingforums.com/showthread.php?t=66300), closing thread. Please don't post the same question in multiple forum categories.

    Thanks!
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •