• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp page checkbox issue

 
Melisa Mitchell
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a checkbox that has a default value of CHECKED. When the user unchecks this box and clicks calculate and the page reloads with the changed data, the checkbox is turned back on. How do i stop this?



it enters the changes into the database, so 1 is on and 0 is off, but like i said when the calculate button is hit and the page reloads the check box is set to checked again.. any ideas?

[Edit: Divided the code in three lines to reduce width of the post]
[ November 05, 2008: Message edited by: Amit Ghorpade ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add conditional logic to the page to emit the checked attribute or not based upon its previous setting.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also, please avoid the usage of scriptlet. you can use JSTL tags.. it is really simple and beauty
 
Melisa Mitchell
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if there is an onclick? I have one, and when I click to turn off the checkbox the page reloads, but then puts the check mark back..
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see what the onclick has to do with it. When the page reloads (regardless of how), if the checked-"checked" is hard-coded onto the page, the box will be checked.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by seetharaman venkatasamy:
also, please avoid the usage of scriptlet. you can use JSTL tags.. it is really simple and beauty
Indeed!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!