[英]How can I clear the entire form client side or would the proper way be to call the controller and clear the model there?
How can I clear the entire form client side or would the proper way be to call the controller and clear the model there? 如何清除整个表单客户端,或者正确的方法是调用控制器并在那里清除模型?
Notice that I have a partial view whose fields I would also want cleared. 请注意,我有一个局部视图,我也想清除其字段。
This is the html. 这是html。 The input (reset) button seems to only reset the values on that form.
输入(重置)按钮似乎仅重置该表单上的值。 In this case the 3 checkboxes and none of the fields in the partial view.
在这种情况下,3个复选框且部分视图中没有任何字段。
For clarity the partial view has several Kendo textboxes and a dropdownlist. 为了清楚起见,局部视图具有几个Kendo文本框和一个下拉列表。
<div class="col-md-6 col-md-offset-3 text-center">
@Html.Partial("_Registration", Model)
<div class="text-left">
<div class="form-group">
@Html.Kendo().CheckBoxFor(x => x.Field1).HtmlAttributes(new { @class = "form-control text-center" })
</div>
<div class="form-group">
@Html.Kendo().CheckBoxFor(x => x.Field2).HtmlAttributes(new { @class = "form-control text-center" })
</div>
<div class="form-group">
@Html.Kendo().CheckBoxFor(x => x.Field3).HtmlAttributes(new { @class = "form-control text-center" })
</div>
</div>
<div class="form-group">
<input type="reset" id="btnReset" class="btn btn-primary" value="Reset" />
<input type="submit" id="btnSubmit" class="btn btn-primary" value="Submit" />
</div>
</div>
如果您有多个表单,则也可以使用JavaScript重置其他表单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.