Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
slamb0513 #1
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
-
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... -
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... -
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... -
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... -
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... -
Nicholas_Bostaph #2
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
-
slamb0513 #3
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
-
Kronin555 #4
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
-
StokeyTCI #5
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



Reply With Quote

