我用剃须刀创建了一个Ajax表单。但我需要完全关闭自动完成程序。在普通形式中,我可以传递html属性autocomplete = "off",但我找不到只接受AjaxOptions和htmlAttributes (任何类型的)的最佳重载。
好的,此页并不能描述Ajax.BeginForm()的17种过载。那里只有11个定义。
我的函数调用看起来
using (Ajax.BeginForm(new AjaxOptions() { ... }))
{
...
}我列出了一些重载,这些重载包含定义中任何类型的htmlAttribute。
Ajax.BeginForm(string actionName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
Ajax.BeginForm(string actionName, string controllerName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
Ajax.BeginForm(string actionName, string controllerName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<string,object> htmlAttributes)
Ajax.BeginForm(string actionName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<string,object> htmlAttributes)
AjaxBeginForm(string actionName, string controllerName, object routeValues, FormMethod method, object htmlAttributes)请告诉我哪一个是我可以利用,没有任何其他功能的影响。或者在autocomplete="off"标记中添加form的其他解决方案..?
发布于 2013-08-14 08:48:22
尝尝这个,
@using (Ajax.BeginForm("Index", "Home", null,
new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "result" },
new {autocomplete ="off"})
)发布于 2013-08-14 08:50:34
您不能为操作名称传入一个空字符串,然后只对路由值使用null吗?
如果要以这种方式传递路由值,可以将路由值从ViewContext中提取出来。
发布于 2016-05-21 06:25:25
注意:,诀窍是只清除密码输入,并将事件处理程序(焦点)放在电子邮件输入上,这样只有当用户开始键入电子邮件时才会清除。如果同时清除两个输入,它将无法工作。
https://stackoverflow.com/questions/18226226
复制相似问题