Click to See Complete Forum and Search --> : showing hint on a select


ljgarcia
10-22-2003, 03:32 PM
Hi everybody!

I want to show a hint when an optiion is selected. This is the code I have, it is included into a JSP. Problem is onchage method is never launched!?

Thanks in advance for your help.

<%@page import="java.util.*"%>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function onChange() {
System.out.println("OnChange");
document.formLeftMethods.onsubmit = true;
}
// End -->
</SCRIPT>

<FORM name="formLeftMethods" method="post" onChange="onChange()" action="/test/controller?OPTION=showHint">
<%
Vector vecLeftMethods = (Vector)session.getAttribute("vecMethods");
%>
<p align="center"><br><SELECT name="listMethods" size=10 width="15">
<% for (int i = 0; i < vecLeftMethods.size(); i++) { %>
<OPTION>
<%= vecLeftMethods.get(i)%>
</OPTION>
<% } %>
</SELECT></p>
</FORM>

simpson97
10-22-2003, 03:57 PM
Try this

<%@page import="java.util.*"%>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function onChange() {
System.out.println("OnChange");
document.formLeftMethods.onsubmit = true;
}
// End -->
</SCRIPT>

<FORM name="formLeftMethods" method="post" action="/test/controller?OPTION=showHint">
<%
Vector vecLeftMethods = (Vector)session.getAttribute("vecMethods");
%>
<p align="center"><br><SELECT name="listMethods" size=10 width="15" onChange="onChange()" >
<% for (int i = 0; i < vecLeftMethods.size(); i++) { %>
<OPTION>
<%= vecLeftMethods.get(i)%>
</OPTION>
<% } %>
</SELECT></p>
</FORM>

Bob