Now you don't have that submit button named "action" anymore, so it doesn't 'think' that the action object is being set to "SearchReco rds" anymore.
Hi,
I just want to call the submitForm1() function on onchange event of location dropdown and want to submit the form to SearchRecords in the code below:(Please see the bold part in code)
[HTML]<%@ page import="java.ut il.ArrayList"%>
<%@ page import="javax.s ervlet.*"%>
<%@ page import="javax.s ervlet.http.*"% >
<html>
<head>
<title> Form </title>
<script language="javas cript" type="text/javascript">
function submitForm1()
{
document.forms[0].action="Search Records";
alert("fghfhfhf ");
document.forms[0].submit();
}
function submitForm2()
{
document.forms[0].action="Search ";
document.forms[0].submit();
}
</script>
<%
ArrayList al=(ArrayList)s ession.getAttri bute("str_");
%>
</head>
<body bgcolor="fuschi a">
<center>
<font size=7 color="red"> Please Enter the following information: </font>
<form name="form1" method="POST">
<table cellspacing="2" cellpadding="2" border="0">
<tr>
<td><input type="hidden" name="role" id="role"></td>
</tr>
<tr>
<td align="left"><f ont size=5>Last Name</font></td>
<td>   ; &n bsp; <inpu t type=text name="sn" value="<%=reque st.getAttribute ("lname") %>"></td>
</tr>
<tr>
<td align="left"><f ont size=5>FullName </font></td>
<td>   ; &n bsp; <inpu t type=text name="cn" value="<%=reque st.getAttribute ("fname")%>"><t d>
</tr>
<tr>
<td align="left"><f ont size=5>Location </font></td>
<td>   ; &n bsp;
<select name="l" onchange="submi tForm1();">
<%if(request.ge tAttribute("loc ation")!=null)% >
<Option value="<%=reque st.getAttribute ("location")%>> <%=request.getA ttribute("locat ion")%></Option>
<Option value="Chandiga rh">Chandigar h</Option>
<Option value="Pune">Pu ne</Option>
<Option value="Banglore ">Banglore</Option>
</select> </td>
</tr>
<tr>
<td align="left"><f ont size=5>Role</font></td>
<%try{%>
<TD>
<select name="erRoles" id="erRoles">
<option>- - - - - - -</option>
<%for(int i=0;i<al.size() ;i++){%>
<Option value="<%=al.ge t(i).toString() %>"><%=al.get(i ).toString()%></Option>
<%}%>
</select>
</TD>
<%}
catch(Exception e)
{
e.printStackTra ce();
}%>
</tr>
<tr>
<td align="right">< input type=submit name=action value="Submit" onclick="submit Form2();"></td>
<td align="left">&n bsp;   ; &n bsp;<input type=reset name="submitBut ton" value="Reset"></td>
</tr>
</table>
</form>
</center>
</body>
</html>[/HTML]
But it warks fine in Firefox and not in IE.if I use alert after document.forms[0].action="Search Records"; it shows neither alert nor submits the form and if i use alert before document.forms[0].action="Search Records"; it shows alert box but don't submit the form.
It also shows a Browser warning on bottom left corner Object doesn't support Line 13(i.e.document .forms[0].action="Search Records";)
Thanks