• 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

how do I know Edit Database Record

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is Ramesh. I am implementing jsp pages. I am displaying database table records and with Edit option in jsp page.
If user select edit button then I have to display that record values with edit mode into form

My doubt is how do I know which record is selected by user.

can any one please give me suggestion.

Thanks & Regards
Ramesh K
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a hidden field in the form for primary key say

Also have a Primary key field for each row appended with index.
if you are using one Edit button for each row use the following script.

You can generate the below code easily using JSP for loop.

<form>
<input type="hidden" name="pkey"/>
<tr>
<td><input type="checkbox" name="key0" value="kkk"/></td>
<td>...all your row data</td>
<td><input type="button" name="edit1" on click="return submitform(0)"/>
</tr>
<tr>
<td><input type="checkbox" name="key1" value="xxx"/></td>
<td>...aall your row data</td>
<td><input type="button" name="edit0" on click="return submitform(1)"/>
</tr>
.
.
.



function submitform(var index) {
vay keyFieldName="key"+index;
document.forms.form1.pkey.value= document.getElement By Id( keyFieldName );
document.forms.form1. submit ();
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic