Results 1 to 7 of 7

Thread: Javascript Question

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    metairie, la usa
    Posts
    40
    Hi,
    I know this is the wrong section to be asking this question , but I usually get someone that knows what there talking about here. Lets say I have two HTML select boxes. Depending on the selection on the first one, I would like to populate the second with other information from a database. Can anyone write me a simple script on how to do this.


    Thanks
    Richard

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    do you want the page to refresh before the 2nd combo box is populated?

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    metairie, la usa
    Posts
    40
    If at all possible, no. I cannot figure out how to write SUBs in coldfusion so that will probably be impossible. I can make it work with refreshing the page, but the database entries are soooo large I didn't want to reload them every time.

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    how much data will have to be sent to the second combo box? If you need to send 100000 records to your page to account for all possibilities for combo box #1, that is not good.....plus the javascript is a bit complicated to dynamically populate the second combo box

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    metairie, la usa
    Posts
    40
    What would be really cool is if I could call ColdFusion code inside the Javascript function. Does anyone know how to do that???

  6. #6
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    from what I understand about cold fusion, it is like ASP.

    ASP is executed on the server, while Javascript is executed on the client. You can't execute ASP script without a page refresh (well, you sort-of can with remote scripting or maybe even frames....)

  7. #7
    Lively Member
    Join Date
    May 2000
    Posts
    123
    if you are only pulling out a few records from the db for each selection, you could load each record set into a javascript array.

    and then when the selection on the first box is made you could then have a function that changes the select.value of the 2nd box via the arrrays based on the selectedIndex of the first box

Posting Permissions

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



Click Here to Expand Forum to Full Width