aspose file tools*
The moose likes Servlets and the fly likes Newbie check box validation on jsp - HELP!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Newbie check box validation on jsp - HELP!!" Watch "Newbie check box validation on jsp - HELP!!" New topic
Author

Newbie check box validation on jsp - HELP!!

Robert Barker
Greenhorn

Joined: Jul 09, 2001
Posts: 1
Help! I've been banging my head against a brick wall for about 3 days now, gotta try for help!
This is my first bit of jsp code and I don't have much experience in javascript either.
I am trying to validate and block the selection of more than three check boxes from a list driven from a database(called db2). once the check boxes have been selected the form parameters are POSTed to another jsp.
I've tried it a number of ways (on submit, onclick etc.) but the fact that it is driven from a database using jsp sql connectivity seems to cause all sorts of problems as I am looping to retrive data from the database Could someone have a look and perhaps suggest something ?
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM ACTION="Display.jsp" METHOD="POST" NAME="FORM">
<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc dbc:db2");
java.sql.Statement statement = connection.createStatement();
java.sql.ResultSet columns = statement.executeQuery("SELECT PRODUCT.TYPE, PRODUCT.ID FROM PRODUCT");
int index = 0;%>
<%
while(columns.next()) {
index++;
%>
<TR> <TD> <%= columns.getString("Type") %> </TD>
<TD> <INPUT TYPE="CHECKBOX" VALUE="<%= columns.getInt("ID")%>" NAME="productid_<%= index%>"></TD> </TR>
<% } %>
</TABLE>
<INPUT TYPE="SUBMIT" VALUE="Click here to compare">

</FORM>
</BODY>
</HTML>
Yours in Frustration
Robert.
[This message has been edited by Robert Barker (edited July 09, 2001).]
[This message has been edited by Robert Barker (edited July 09, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newbie check box validation on jsp - HELP!!