This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how do I know Edit Database Record  RSS feed

 
ramesh kancherla
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • 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
 
Goutham Pallipati
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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 ();
}
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!