it is something like this where i check 1st button i can get the January month savngs which are in a text field 大家好我计划按如下方式创建一个表,它在每行的第一列中包含一个复选框,一旦选中该复选框,我必须将路径属性发送到“next”url byu点击提交按钮我该怎么办?
<form action="/next" method="post">
<table cellspacing="25" align ="center">
<tr>
<td> </td>
<td></td>
<td>Name</td>
<td>Path</td>
<td>Date</td>
</tr>
{% for obj in obj_list %}
<td><input type="checkbox" name="insta" value="">
<td>{{ obj._id }}</td>
<td>{{ obj.name }}</td>
<td><input type="text" name="path" value="{{ obj._path }}" disabled="disabled" ></td>
<td>{{ obj.date }}</td>
{% end %}
</table>
</div>
<div id="send">
<input type="submit" value="Send">
</div>
</form>
答案 0 :(得分:0)
如果没有添加JQuery,请尝试这个, 添加此js函数
function changeUrl(clickedChk)
{
if( $(clickedChk).is(":checked") )
{
var path = $($(clickedChk).closest("tr").find("input[type=text]")[0]).val();
$("#myform").prop("action",path);
}
}
稍微改变你的html
<form id="myform" action="/next" method="post">
<table cellspacing="25" align ="center">
<tr>
<td> </td>
<td>Id</td>
<td>Name</td>
<td>Path</td>
<td>Date</td>
</tr>
{% for obj in obj_list %}
<tr>
<td><input onclick="changeUrl(this)" type="checkbox" name="insta" value="">
<td>{{ obj._id }}</td>
<td>{{ obj.name }}</td>
<td><input type="text" name="path" ></td>
<td>{{ obj.date }}</td>
</tr>
{% end %}
</table>
</div>
<div id="send">
<input type="submit" value="Start">
</div>
</form>
答案 1 :(得分:0)
假设您希望在用户点击复选框时自动提交表单,我建议使用以下内容 -
CHARACTER SET latin1