• 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

saving multiple rows

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello

i have some stupid problems at jsp-servlet comunication.
in my jsp i have a table with multiple columns, <input type="text"..> and one column that has a checkbox. of course i take the data from a database,so i can have a lot of rows in that table. My plan is to have this checkbox being editable..for any row. So when the user pressed the "save" button, it saves the changes in db. I have the checkbox a name, to send it to the servlet . this works correct. now i wanted to detect when the users checks and unchecks the checkbox.
This is done with js i presume, at onclick. but i don't get what i am seding in that javascript, so i can use in the servlet, (in my logic of distinguishing the cheked and uncheck box).
as i said, trivial question, but i am a bit stuck. thank you
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the checkbox is unchecked it will not be sent to the server as part of the form submission.
 
bubu lina
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
then how can i make a list of unchecked rows?
 
Bear Bibeault
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The ones that don't come back are the unchecked rows.
 
bubu lina
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes..but doesn't this make the recognizing the row that had the checkbox modified kinda difficult?
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you need to do is to disable textboxes whose checkbox is not checked (i.e. the checkbox in that row). This can be done using javascript and DOM. Also you can actually do this only on the server side. If my checkboxes are named "rowNo" having values 1 for the checkbox in first row, 2 for the checkbox in 2nd row and the textboxes are named name1, age1 for first row, name2, age2 for second row, then you can easily extract only the elements from the request parameters whose checkboxes were checked...
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic