• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp self submit

 
sreekanth rach
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends!!
In Jsp, i have 4checkboxes,one button..
My Requirement is:
After selecting some checkboxes (any combination of selection) & click button -
I want to get a report on the same page according to my selection of checkboxes..
Everything is working fine, The only problem what 'am facing is, once i click button,the previously selected checkboxes r getting refreshed..
Can Anyone Help Me Pls.
Sreekanth.
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem you are facing is coming because you should overwrite the default submit action of the button. Write javascript function which handles submit event of the form and disply the report on the same page and return false.
Example code:
<html>
<head>
<title>Report</title>
<script language="javascript">
function handleSubmit(){

alert("Write your report here");

return false;
}
</script>
</head>
<body>

<form onsubmit="return handleSubmit()">
Name : <input type="text"></input><br></br>
Age : <input type="text"></input><br></br>
<!--
put the check boxes here

-->
<input type="submit" ></input>
</form>

</body>
</html>
Now your checkboxes will not refresh.
Enjoy
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe that is what they want. This solution stops the checkboxes from being reset by stopping the form from being submitted.
If you want to retain the checkbox values, you'll need to get the value from the request and set it on the checkbox. It won't be retained automatically for you.
Dave
 
sreekanth rach
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dear, somehow i managed with ur valuable help..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!