This content has been marked as final. Show 4 replies
you have 2 choices
1) submit the form when the user selects a time. query the database based on the time selected to get the available pieces of equipment, re-load the form with the query data in the 2nd drop down. (i don't endorse this choice)
2) use AJAX. it's very much the same as choice #1, except the form does not submit when the time dropdown is changed. you use AJAX to go back to the server, query the database to determine which pieces of equipment are available for the selected time, then use JS to populate the 2nd drop down. this all occurs behind the scenes to the user.
I've been using the JSMX AJAX library recently for a project and liking it a lot. it's fairly lightweight (just 2 .js files), but you do need to be comfortable with JS in order to do something with the data that's returned from the AJAX call.
Spry is Adobe's AJAX library, which I think makes it a bit easier to "plug in" the data from the AJAX call after it's been returned.
JSMX can be found at http://www.lalabird.com
Spry can be found at http://labs.adobe.com/technologies/spry/
Additional info on Spry can be found at:
http://carehart.org/spry/spry_resources.cfm and http://ray.camdenfamily.com/index.cfm/AJAX
As well as refreshing the HTML or using AJAX, one could also do this in
FLEX, but that is a whole different ball of wax, and probable not a
great choice if one is not interested into jumping into the whole FLEX
world at this time.
If the amount of data is not large, there is a better option. Get all the data when you load the page and use related selects.
"better" is a subjective term :)
i really enjoy JS and have written plenty of JS arrays to handle related selects. nowadays tho I find it easier to just use an existing AJAX library (I lean towards JSMX) to handle the task.