This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hello Peter, First I would say why you want to use JavaScript, why not jsp at both pages. Okay, here is your solution........ HTML file using java script.
This is just a sample code.You can modify it according to your requirment. ------------------ Regards Gurpreet Sachdeva For Mock Exams, FAQ, Exam tips and some useful information about Bitshift operator, inner classes, garbage collection,etc please visit: http://www.go4java.lookscool.com [This message has been edited by Gurpreet Sachdeva (edited October 26, 2001).]
Regards<BR>Gurpreet Sachdeva<P>For Mock Exams, FAQ, Exam tips and some useful information about Bitshift operator, inner classes, garbage collection,etc please visit: <A HREF="http://www.go4java.lookscool.com" TARGET=_blank rel="nofollow">http://www.go4java.lookscool.com</A>
Peter Guillebaud
Ranch Hand
Joined: Jul 11, 2001
Posts: 57
posted
0
Thanks Gurpreet, What I am trying to do is have one html select box populated as a result of a choice from a previous select box. I want to avoid having submit buttons but to use the onChange() method of the select box. What needs to happen is when the user chooses a value from the first box, the onChange() event on the client side somehow fires a sql query which populates the second box according to the choice in the first. Any ideas welcome! TIA [This message has been edited by Peter Guillebaud (edited October 29, 2001).]
Well, just remember that javascript is 100% client-side, and JSP code is 100% server-side.
There is really no way to get JSP code to run, and return to the 'same' page on the client side. You'll need a re-load of some sort. You *can* use javascript to submit the page to your server-side code, be it a JSP (and of course, you can submit the page to itself) or servlet. The server-side will know which value in the first select box has been selected, and when it is finished, it will re-display with both select boxes full of values.
Peter Guillebaud
Ranch Hand
Joined: Jul 11, 2001
Posts: 57
posted
0
thanks Mike, I used javascript to resubmit the jsp page to itself when the onchange() event was fired in the select box, and then jsp to do the sql query. Thanks for your help!