Dynamically Populate Multiple Select Boxes

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Dynamically Populate Multiple Select Boxes

    I am trying to develop an application where a user selects the Year, Make and
    Model of their vehicle. In the past, I had a query that input the vehicle year
    into a select box. When a user picked the year, the form would submit and go
    to page 2. Page 2 would then select the Make of the vehicle based on the year
    chosen, and page 3 would select the model based on the year and make. After
    the vehicle was chosen, they would input some user info, a validation test is
    done and the data is submitted to a database. What I want to know is if there
    is an easier way to dynamically populate the select boxes the same way using
    cold fusion without ever leaving the first page? Remember, the form has to be
    able to submit to a database at the end. Thanks for the help.

    slamb0513 Guest

  2. Similar Questions and Discussions

    1. How to build populate datagrids dynamically
      The data returned from the server in my flex app is one-dimensional: A 1 xyz A 2 abc A 3 pqr I want to put this data into a datagrid so...
    2. Multiple select of list boxes
      I am allowing my users to select multiple items in a list box, and I've set that up so it works swell. However, I'm unsure how to set each of the...
    3. Populate select field and textbox dynamically - no refresh
      Ive got a db table with the fields Product_Name and Product_Price. I want to display a pulldown containing the product names and display the...
    4. Best way to populate a <SELECT>
      Hi All I've being doing it my own little way for sometime now, but I'm not sure if its the best. When I'm doing a recordset for a simple...
    5. Dynamically populate a word document from Oracle
      you may want to try posting in the JRun forums. There are a lot of very good JSP coders there. -- Mike ------------------- Michael Langner...
  3. #2

    Default Re: Dynamically Populate Multiple Select Boxes

    This is not possible with ColdFusion, but could be pretty easily done with
    javascript. There are a number of free JS snippets on the web that will do
    this for you, for instance:
    [url]http://www.mattkruse.com/javascript/dynamicoptionlist/[/url]. Just do a google
    search.

    Nicholas_Bostaph Guest

  4. #3

    Default Re: Dynamically Populate Multiple Select Boxes

    The only problem with those Javascript functions is that there are over 20,000 different variations of vehicle year, make and models so I need the script to connect to a database to pull the options.
    slamb0513 Guest

  5. #4

    Default Re: Dynamically Populate Multiple Select Boxes

    There are several ways to do this. The biggest buzzword that answers this
    request right now is AJAX. I'm sure you're already aware of this, but anytime
    you try to move this logic into the client, you either give yourself a major
    headache trying to support a bunch of browsers, or you limit it to 2 or 3
    browsers (newer versions, obviously).

    All it is is a bunch of Javascript processing, with XMLHttpRequest pulling the
    necessary data, and manipulation of the DOM directly based on the results of
    the XMLHttpRequest call.

    Here's some links of interest:
    [url]http://www.javalobby.org/articles/ajax/[/url]
    [url]http://www.modernmethod.com/sajax/[/url]

    Kronin555 Guest

  6. #5

    Default Re: Dynamically Populate Multiple Select Boxes

    I would do it with booth javascript, and coldfusion 1. for the javascript
    create a postback ie <script language='JavaScript' type='text/JavaScript'>
    function postback(){ document.form1.action = 'yourpage.cfm';
    document.form1.submit(); } </script> Now for the coldfusion wrap your query
    in a cfif <cfif isdefined('form.year')> <cfif #form.year# is not ' ' >
    <cfquery name = 'getmake' datasource ='datasource'> Select make from maketable
    where year = #form.year# </cfquery> </cfif> </cfif> So now you have a query
    that will only fire if the year input box is defined, and you would do the same
    thing with the model. and create your inputbox <input name='year' onblur=
    'postback();'> once the user puts in a year and tabs to next field, the page
    basically reloads your year is defined, so your query fires only giving you the
    makes that are available for the year they inputed. Then just create a page to
    update to your database Cheers Chris

    StokeyTCI Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139