Hi, i have list box in a form that is pulling data from a mysql db. when i click on an item in the list box i want data to change in other text boxes in the form. i have most of the code to it......BUT... i need to put that code into a function and call it in the onChange event in the form. i have tried to do this but ikeep getting the following error: org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 18 in the jsp file: /Administrator/addPromotion.jsp Generated servlet error: [javac] Compiling 1 source file C:\tomcat\work\Catalina\localhost\_\org\apache\jsp\Administrator\addPromotion_jsp.java:84: ';' expected function ChangeDynamicData(){ ^ 1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351) org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415) org.apache.jasper.compiler.Compiler.compile(Compiler.java:458) org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:853) im just not too sure how to structure my function and how to call it. any replies would be greatly appreciated!! cheers
Bear Bibeault
Author and opinionated walrus
Marshal
ok, is there a way to refresh the browser in the onChange event?
Winston Smith
Ranch Hand
Joined: Jun 06, 2003
Posts: 136
posted
0
You can do this all with javascript, you want to stay away from JSP for this one. Your onChange() event is controlled by javascript, so, in your onChange() function, you can simply use javascript to replace the values in the fields you want to change. So for instance, assume I have the following bit of code:
When you click the button, the text in the textarea will change. You can use these scheme to change DOM components dynamically. NOTE: onKlick() has been changed to conform to the Ranch posting requirements -- it should be spelled with a C, of course. [ April 01, 2004: Message edited by: Winston Smith ]
for (int i = today; i < endOfTime; i++) { code(); }
Bear Bibeault
Author and opinionated walrus
Marshal
Quite correct; there is no need for server-side activity to accomplish this. I'm moving this to the HTML/Javascript forum for any further discussion.
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
posted
0
refreshing the browser: onclick="document.location.href=document.location.href" or onclick="document.location.reload()" [ April 01, 2004: Message edited by: Eric Pascarello ]