0
我想打开一个表单,其中的字段中填有相应于某个记录的数据。Javascript:如何打开填充参数的字段的表单?
实施例:
Supose一定的形式:
<table id="tabledogs" class="ui-widget ui-widget-content"> <thead> <tr class="ui-widget-header "> <th>ID</th> <th>Name</th> <th>Action</th> </tr> </thead> <tbody> <c:forEach var="dog" items="${sessionScope.dogs}"> <tr> <td width="50%" align="left">${dog.id}</td> <td width="50%" align="left">${dog.name </td> <td><button id="update">Update</button> </td> </tr> </c:forEach> </tbody> </table> </div>
我想与内它的相应狗数据打开以下形式(还有其他表格配置没有显示在这里以节省空间):
<form> <fieldset> <label for="id">ID</label> <input type="text" name="id" id="id" class="text ui-widget-content ui-corner-all" /> <label for="name">Name</label> <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" /> </fieldset> </form> </div>
因为尽管我有以下的JavaScript,至极打开表单,但没有数据:所有这些东西都工作正常
$("#update").button().click(function() {
$("#dialog-form").dialog("open");
});
- 。 如何将狗的数据传递给要显示的表单?正如你可能看到的,我在SessionScope中有一组“狗”对象。感谢您的帮助!