submit function

pls can anyone help me,

After I use the submit() of javascript to re submit a form to itself I had 2 include the page name in the action value of form

<form action=mypage.jsp method="get">

I have a button continue which I need to click on to take me to another page. how do I go about this pls

thanks

[339 byte] By [olicksa] at [2007-10-2 7:32:08]
# 1

First, in future please write out the complete words ( 'to' NOT '2' ), the extra keystroke won't hurt you!

Second, if I understand your question correctly...

<form name="myForm" action="mypage.jsp" method="get">

<input name="field1">

<input type=button value="Submit" onClick="document.myForm.submit();">

<input type=button value="Continue" onClick="document.myForm.action='someotherpage.jsp';document.myForm.submit();">

</form>

HTH.

munyula at 2007-7-16 21:11:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

thanks for the advice,but actually there is only one button and i have an onchange event attached to a combobox which populates another combobox when selected,both value are picked from the database onload of the page.The onchange event actually calls a function that resubmits more like refreshes the page.so I have no idea how to send the details to another jsp page because I have the Ist jsp file name as the value of the action attribute in the form element .thank you

I have included the code below thanks again for your help

[code][/c<%@ page import="java.sql.*"%>

<%

Class.forName("com.mysql.jdbc.Driver");

Connection con2 = DriverManager.getConnection("jdbc:mysql://localhost/schoolsgateDB?user=roy&password=arsenal");

//String parame1 = "";

//String param2 = "";

String parame = request.getParameter("school");

//parame1 = request.getParameter("button");

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>SchoolsGate.com - An Online secure, efficient & convinient School Fees Payment system</title>

<link href="../styleshet.css" rel="stylesheet" type="text/css">

<script language="javascript">

function next(){

document.form1.submit();

}

</script>

</head>

<body class="bg" topmargin="10" leftmargin="0">

<form name="form1" action="onlinePaymentHome.jsp" method="get" onsubmit="">

<table width="703" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td class="topgradient"><img src="/images/spacer.gif" width="10" height="7"></td>

</tr>

</table>

<table width="715" border="0" align="center" cellpadding="0" cellspacing="0">

<tr valign="top">

<td width="6" class="leftgradient"><img src="../images/spacer.gif" width="10" height="7"><img src="/images/spacer.gif" width="6" height="7"><img src="../images/spacer.gif" width="10" height="7"></td>

<td width="700" valign="top" bgcolor="#FFFFFF"><table width="723" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="5" rowspan="3" bgcolor="#FFFFFF"><img src="../images/spacer.gif" width="5" height="70"></td>

<td width="236" rowspan="3" bgcolor="#FFFFFF"><img src="../images/logoname.gif" width="236" height="42"></td>

<td width="130" rowspan="3" bgcolor="#FFFFFF"> </td>

<td width="233" height="30" bgcolor="#FFFFFF" class="textred">Secure</td>

<td width="119" rowspan="3" valign="bottom" bgcolor="#FFFFFF"><img src="../images/pic_right_head.jpg" width="67" height="22"></td>

</tr>

<tr>

<td height="26" bgcolor="#FFFFFF" class="textred">Efficient</td>

</tr>

<tr>

<td height="15" bgcolor="#FFFFFF" class="textred">Convinient</td>

</tr>

</table>

<table width="724" border="0" cellspacing="0" cellpadding="0">

<tr class="bggrey">

<td width="5" height="24"><img src="../images/spacer.gif" width="5" height="24"></td>

<td width="31" class="linkstop"><a href="../index.jsp">Home</a></td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="1" class="bggreydark"><img src="../images/spacer.gif" width="1" height="1"></td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="58" class="linkstop"><a href="#">Payments</a></td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="1" class="bggreydark"><img src="../images/spacer.gif" width="1" height="1"></td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="110" class="linkstop"><a href="#">Partner schools</a> </td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="1" class="bggreydark"><img src="../images/spacer.gif" width="1" height="1"></td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="98" class="linkstop"><a href="#">partner banks</a> </td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="1" class="bggreydark"><img src="../images/spacer.gif" width="1" height="1"></td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="74" class="linkstop"><a href="#">contact us</a> </td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="1" class="bggreydark"><img src="../images/spacer.gif" width="1" height="1"></td>

<td width="10" class="linkstop"><img src="../images/spacer.gif" width="10" height="10"></td>

<td width="117" class="linkstop"><img src="../images/spacer.gif" width="94" height="8"></td>

<td width="126" class="linkstop"><img src="../images/pic_right_head2.jpg" width="81" height="24"></td>

</tr>

</table>

<table width="700" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="557" valign="top" bgcolor="#FFFFFF"><img src="../images/spacer.gif" width="575" height="1"></td>

<td width="143" valign="top" bgcolor="#FFFFFF"><img src="../images/pic_right_head2_5.jpg" width="81" height="1">

</td>

</tr>

</table>

<table width="726" border="0" cellspacing="0" cellpadding="0">

<tr class="bgblue2">

<td width="36" height="20"><img src="../images/spacer.gif" width="36" height="10"></td>

<td width="37" valign="bottom"><img src="../images/pic_boyhead1.jpg" width="31" height="9"></td>

<td width="39"><img src="../images/spacer.gif" width="37" height="10"></td>

<td width="81" valign="bottom"><img src="../images/pic_girlhead1.jpg" width="70" height="15"></td>

<td width="254"> </td>

<td width="34" valign="bottom"><img src="../images/pic_cap1.jpg" width="34" height="14"></td>

<td width="114"><img src="../images/spacer.gif" width="95" height="8"></td>

<td width="131"><img src="../images/pic_right_head3.jpg" width="83" height="20"></td>

</tr>

</table>

<table width="724" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="724"><img src="../images/pic_home.jpg" width="725" height="123"></td>

</tr>

</table>

<table width="725" border="0" cellspacing="0" cellpadding="0">

<tr valign="top">

<td width="42" class="bg"><img src="../images/spacer.gif" width="42" height="30"></td>

<td width="390" valign="middle" class="bg"> </td>

<td width="26" class="bg"><img src="../images/spacer.gif" width="26" height="30"></td>

<td width="267" valign="middle" bgcolor="#FFFFFF" class="bg">

<div align="center"></div></td>

</tr>

</table>

<table width="723" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="156" rowspan="3" valign="top" class="menurow"><table width="148" border="0" cellspacing="0" cellpadding="0">

<tr>

<td> </td>

<td> </td>

<td class="linkstop"> </td>

</tr>

<tr>

<td width="8"><img src="../images/spacer.gif" width="5" height="10"></td>

<td width="20"><img src="../images/bullets.gif" width="15" height="13" hspace="2"></td>

<td width="120" class="linkstop">Payments</td>

</tr>

<tr>

<td colspan="3"><div align="right"><img src="../images/spacer.gif" width="123" height="1" class="bggrey"></div></td>

</tr>

<tr>

<td> </td>

<td><img src="../images/bullets.gif" width="15" height="13" hspace="2"></td>

<td class="linkstop">Partner schools </td>

</tr>

<tr>

<td colspan="3"><div align="right"><img src="../images/spacer.gif" width="123" height="1" class="bggrey"></div></td>

</tr>

<tr>

<td> </td>

<td><img src="../images/bullets.gif" width="15" height="13" hspace="2"></td>

<td class="linkstop">partner banks </td>

</tr>

<tr>

<td colspan="3"><div align="right"><img src="../images/spacer.gif" width="123" height="1" class="bggrey"></div></td>

</tr>

<tr>

<td> </td>

<td><img src="../images/bullets.gif" width="15" height="13" hspace="2"></td>

<td class="linkstop">contact us </td>

</tr>

<tr>

<td colspan="3"><div align="right"><img src="../images/spacer.gif" width="123" height="1" class="bggrey"></div></td>

</tr>

<tr>

<td> </td>

<td> </td>

<td class="linkstop"> </td>

</tr>

</table></td>

<td width="501" height="12" class="hwineline"> <div align="left"><strong>Online

Payment</strong> </div></td>

<td height="12" colspan="2"> </td>

</tr>

<tr>

<td height="13" colspan="2" class="hwineline"><div align="left"></div>

<div align="left" class="text">Kindly complete the form below to proceed

with your online school fee payment.</div></td>

<td width="65" height="13"> </td>

</tr>

<tr valign="top">

<td colspan="2" class="text"> <table width="111%" border="0">

<tr>

<td width="17%" class="tablelabels"> <div align="right">School Name :</div></td><input type="hidden" name="which">

<%

try

{

Statement stt = con2.createStatement();

ResultSet rss = stt.executeQuery("Select * from schoolsmst");

out.println("<td colspan='2' class='text'>");

out.println("<select name='school' id='select2' onchange='next()'>");

out.println("<option value='select'>Select School</option>");

while(rss.next())

{

String str1 = rss.getString(1);

String str2 = rss.getString(2);

if(parame.equals(str2))

{

out.println("<option selected value="+str2+">"+str1+"</option>");

}

else

{

out.println("<option value="+str2+">"+str1+"</option>");

}

out.println("<br>");

}

out.println("</select>");

}

catch(Exception e)

{

out.println(e.toString());

}

%>

</td>

</tr>

<tr>

<td class="tablelabels"> <div align="right">Student ID No :</div></td>

<td colspan="2" class="text"><input name="studentNo" type="text" id="studentNo">[Enter Student's school assigned identification number]</td>

</tr>

<tr>

<td class="tablelabels"><div align="right">Student Name :</div></td>

<td colspan="2" class="text"><input name="studentName" type="text" id="studentName" size="40"></td>

</tr>

<tr>

<td class="tablelabels"><div align="right">Student Group :</div></td>

<%

try

{

PreparedStatement pstt = con2.prepareStatement("Select * from schoolsgroups where SchoolCode = ?");

pstt.setString(1,parame);

ResultSet prss = pstt.executeQuery();

out.println("<td colspan='2' class='text'>");

out.println("<select name='studentGroups' id='select3'>");

out.println("<option value='select'>- Select - department</option>");

while(prss.next())

{

String str1 = prss.getString(3);

String str2 = prss.getString(2);

out.println("<option value="+str2+">"+str1+"</option>");

out.println("<br>");

}

out.println("</select>");

}

catch(Exception e)

{

out.println(e.toString());

}

%>

</td>

</tr>

<tr>

<td class="tablelabels"><div align="right">Payee :</div></td>

<td colspan="2" class="text"> <input name="payee" type="text" id="payee" size="40"></td>

</tr>

<tr>

<td class="hrwinelniebtt">

<input name="button" type="submit" id="button4" value="Continue"></td>

<td width="73%" class="hrwinelniebtt"> </td>

<td width="10%"> </td>

</tr>

</table>

</td>

</tr>

<tr valign="top">

<td> </td>

<td colspan="3"> </td>

</tr>

</table></td>

<td width="7" class="rigthgradient"><img src="../images/spacer.gif" width="7" height="7"></td>

</tr>

</table>

<table width="703" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td colspan="4" class="bgblue2"> <div align="center"><em><font color="#FFFFFF" size="2">Powered

by Empire</font></em></div></td>

</tr>

</table>

</body>

</html>

ode]

olicksa at 2007-7-16 21:11:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

What I wrote to you was and still is the answer that you require!!!

Here is how you can change your code:

Firstly change the form tag:

<form name="form1" action="YourSubmitPageHere.jsp" method="get">

Enter the correct submit page in here in your form action property, NOT the page which the combobox onchange event goes to!

Second, change the next function for the combobox onchange event!

function next()

{

document.form1.action='onlinePaymentHome.jsp';

document.form1.submit();

}

HTH.

munyula at 2007-7-16 21:11:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...