-
1. Re: How to display value in B combobox with change in combob
nigelwhite Dec 20, 2005 8:34 AM (in response to sanu_82)You want a javascript forum.
Basically, you hook your javascript code into the onchange of combobox A.
You'll need to understand the DOM model of HTML documents:
http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/ecma-script-binding.html
which is a special case of the general DOM model:
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
You will use a few of those methods to modify the HTML document. -
2. Re: How to display value in B combobox with change in combob
sanu_82 Dec 21, 2005 4:32 AM (in response to sanu_82)I got the point but only wording mistake took place.
My question is ----
In my jsp page I have 2 combo boxes--data of 2nd comboBox is dependent on the 1st. The data for 2nd is previously obtained from a database.
Regards
sanu -
3. Re: How to display value in B combobox with change in combob
sanu_82 Dec 21, 2005 4:34 AM (in response to sanu_82)I got the point ,but the mistake was of wording i used.
My question is --
In my jsp page I have 2 combo boxes--data of 2nd comboBox is dependent on the 1st. The data for both is previously obtained from a database. -
4. Re: How to display value in B combobox with change in combob
nigelwhite Dec 21, 2005 6:00 AM (in response to sanu_82)OK, your onchange code is going to have to use an XMLHttpRequest:
http://developer.apple.com/internet/webcontent/xmlhttpreq.html
and
http://www.google.co.uk/search?hl=en&q=XMLHttpRequest&btnG=Google+Search&meta=
It will use one of these objects to send a request with whatever parameters are needed to producde the new combobox data back to a servlet which will send back a response.
The way I do this is I have the servlet send back a response of type "text/javascript", and send the javascript code to call those DOM methods and update the second combobox. (You did read those DOM documents didn't you?)
Back in the browser, in your javascript onreadystatechange handler which processes the response when the readyState == 4, you can eval() the responseText, and it will be executes. NB: Put a try{}catch{} round it so that you can highlight bugs in your returned javascript... takes a while to write bug-free javascript, especially when you have to compile your servlet and run your app to get the javascript out into the browser.
Don't forget to do a setTimeout() to call a failure method after a certain time - which is cancelled by the onreadystatechange handler on success - to handle server non-response! -
5. Re: How to display value in B combobox with change in combob
sanu_82 Dec 23, 2005 12:04 AM (in response to sanu_82)Hi
Nigel
I want to know is no method or coding to do this in JSP rather than xml.
Regards
Sandhya