This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

saving multiple rows

 
bubu lina
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then how can i make a list of unchecked rows?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ones that don't come back are the unchecked rows.
 
bubu lina
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes..but doesn't this make the recognizing the row that had the checkbox modified kinda difficult?
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic