Msg#: 4444585 posted 8:58 am on Apr 24, 2012 (gmt 0)
Here's what I'm trying to achieve. I have an input box that dynamically looks up values from a mysql database on each key press and displays them in a dropdown list, this works great. Upon selecting from the drop down that input box is populated along with another input box, the second input box is populated with an ID from the database based on the selected value.
I would like to execute another SQL based on the ID from the second input box using the onchange event of the first.
I'll post some code so hopefully my problem is explained better.
Msg#: 4444585 posted 9:16 am on Apr 25, 2012 (gmt 0)
If you use ajax you could display the first input box only, then with the onchange event you could send a request to the server to pull in the values for the second input box and display it and so forth. If always going to have 2 levels of hierarchy set something like this on the initial screen:
Msg#: 4444585 posted 8:58 am on Apr 26, 2012 (gmt 0)
Ok it you could setup the company input like you do with the tv_id ie: disabled.
Here is some jQuery code that can help it hooks the input fields of a form and sends requests to the server when the enter key is pressed. When the server responds the server_output var contains the response. You can use that to decide whether or not to activate the other input boxes or set their values, or perhaps just override the html form with what was returned from the server etc.