简体   繁体   English

在每次单击编辑按钮时获取数据库中记录的正确ID

[英]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. 我在每行中都有一个html表,我有一个名为“ edit”的按钮,允许用户使用他选择的参数来重新编辑表单。 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. 为此,我定义了一个隐藏类型,以获取数据库中记录的ID,以访问各种结肠,并使用这些参数刷新表单。 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. 我现在面临的挑战是如何在每次单击编辑按钮时获取正确的ID,以使我能够获得正确的记录并在数据库中对其进行更新。 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. 我意识到用javascript提交,并且我想在用户单击“提交”按钮后立即获取idDailyTimesheet。 thanks for help. 感谢帮助。

Set the id of the button to the id in the database? 将按钮的ID设置为数据库中的ID?

Or with html5 you are allowed to declare data-* tags on a html element. 或者使用html5,您可以在html元素上声明data-*标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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