简体   繁体   中英

get the right id of a record in database in each click on the edit button

i am facing a big problem right now. I have a html table in each row i have a button called edit allowing user to relod the form with parameter that he has selected. for this i define a hidden type to get the id of the record in database to access to various colonne and to refresh the form with those parameters. My challenge now is how to get the right id in every click on the edit button to let me after to get the right record and to update it in the data base. I am preceeding like the following:

retour.append("<td style=border-right:#FFF  bordercolor=#FFFFFF>");
retour.append("<input type=\"hidden\" id=\"id_"+nomTab+"_"+compteur+"\"  value=\""+object.getIdDailyTimeSheet()+"\"  name=\"hd"+compteur+"\" />");                             
retour.append("<button  id=edit name=edit type=button  onClick= editarow()>");
retour.append("<img src=edit.gif />");
retour.append("</button>");
retour.append("</td>");

i realise the submit in javascript and i want to get the idDailyTimesheet everyonce the user click the submit button. thanks for help.

Set the id of the button to the id in the database?

Or with html5 you are allowed to declare data-* tags on a html element.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM