Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute a SQL statement with "onChange"

Status
Not open for further replies.

fdarkness

Programmer
Joined
Feb 17, 2006
Messages
110
Location
CA
Ok, after skimming through some of the posts here, I'm reading that JavaScript can't process a SQL query within CF.

If such is the case, how can I execute a SQL query with an onChange event within a select tag (drop down box)? I want to execute either an UPDATE or INSERT when the contents of the dropdown are changed.
 
You can either have the onChange refresh the page that will cause the SQL to rerun, or have the onChange run an action page that will run the SQL code and then redirect the user back to the form itself.

What is the scenario? Maybe there is an alternate solution.

____________________________________
Just Imagine.
 
Basically, when the page loads, it runs a SQL query that pulls the data from the DB. Then it displays the data in a table, one row per record from the DB. Two columns have pull down menus. The pull downs either display "Choose" if there's no value from the DB or the value which is gathered from the initial SQL query.

Regardless of what the value is, when the contents of any pull down menu is changed, it should fire the onChange event in it and update that specific record in the DB, changing the value and redisplaying the page with the new information. Knowing my coworkers, they'll make changes and forget to save and they'll come squawking to me that I need to code it so it automatically saves for them (since they need things to do everything for them).

Makes sense?

I'd supply screen shots or code, but I'm now at home and don't have access to my application. :/
 
sounds like you want an AJAX-type request to be sent off to the server

wish i knew how to do that, eh

;-)



r937.com | rudy.ca
 
I don't even know what the heck an "AJAX" type request is! Please enlighten me? :)

(I generally code in ASP... I'm being forced into this ColdFusion stuff since the guy who wrote the site refused to learn anything else and *demanded* CF. Now I've replaced him and get the joys of reading pages of really badly coded work which has been stressing me out for months. I was assigned the job of recoding it in ASP, but in the meantime, I get to hit his code now and then with a hammer to change things or add to it.)
 
imstillatwork: if that's the case, how do you deal with events? How would you approach the situation I'm having? I'm open to other ideas and suggestions. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top