• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp self submit

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Dear, somehow i managed with ur valuable help..
 
reply
    Bookmark Topic Watch Topic
  • New Topic