Click to See Complete Forum and Search --> : How to judge which checkbox objects are checked in server side?server


Lily
04-05-2003, 04:08 AM
Hello all,

If there are many check objects shown on page and they belong to the same form with a 'delete' button listed below. My goal:
1. delete those checkbox objects that are checked from the
page when click on 'delete' button.
2. get the name of thoes checked checkbox objects at server
side and delete the corresponding records from database.

How can I get those checked checkbox objects' value at the sever side?

for example:
<form name="myForm" method= "post" action=" submitForm()" >
<TR bgColor=#eeeeee>
<TD noWrap align=left><INPUT type="checkbox" name="<%= inputSkillName %>" value="<%= inputSkillName %>"><%= inputSkillName %></TD>
<TD noWrap align=left>
<INPUT type="radio" name="<%= newSkillRadio %>" value="5"> 5 &nbsp;
<INPUT type="radio" name="<%= newSkillRadio %>" value="4"> 4 &nbsp;
<INPUT type="radio" name="<%= newSkillRadio %>" value="3"> 3 &nbsp;
<INPUT type="radio" name="<%= newSkillRadio %>" value="2"> 2 &nbsp;
<INPUT type="radio" name="<%= newSkillRadio %>" value="1"> 1 &nbsp;
<INPUT type="radio" name="<%= newSkillRadio %>" value="0" checked> 0 &nbsp;
</TD>
</TR>
<TR>
.....
</TR>
</from>
<a><INPUT type="submit" name="delBtn"
value="Delete">delete</a>
...

each TR element includes one checkbox
object, when click on the delete button,I want to delete those checked TR element from page

Any help is thankful!

Lily

khalidali63
04-05-2003, 07:29 AM
Originally posted by Lily

How can I .............. value at the sever side?
<form name="myForm" method= "post" action=" submitForm()" >
</from>
........

your forms action="" attribute is empty.

Say if you use jsp and your database connectivity logic is in process.jsp
then you will have this value in the action attribute
action="process.jsp"
your browsers knows from this point that it needs to pass all the form data with names and values to your server side processing page.
On the server side you can retrieve these values using HttpServeletRequest objects method
request.getParameter("formFieldName");

And the above process (sending data from form to serverside processing page) is same regardless of any programming language.

Hope this helps

Cheers

Khalid

khalidali63
04-05-2003, 07:41 AM
:D
The flow of data logic will remain the same..only the syntax will be changed(in asp case even the code wouldnt change much)
Khalid