English 中文(简体)
j 质量鉴定工作有投入类型=“提交书”,但不包括html纽扣元件。 为什么?
原标题:jQuery validation works with input type="submit", but not html button element. Why?

利用伙伴关系。 NET,原因何在。 de j Query accreditation plugin阻碍在使用投入类型=“提交”要素时提交表格,而不是使用html纽扣元素?

在使用html纽顿(类型=“提交”)标签时,验证火力仍然存在。

是否有办法使j Query的验证金矿与html纽顿分子合作?

快速例子:

<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <script type="text/javascript">
            $(document).ready(function () {
                $("#form1").validate({
                    rules: {
                        txtFirstName: {
                            required: true
                        }
                    },
                    messages: {
                        txtFirstName: {
                            required: "* First Name required<br/>"
                        }
                    }
                });
            });
        </script>
    </head>

    <body>
        <form id="form1" runat="server">
            <input id="txtFirstName" name="txtFirstName" type="text" />
            <input id="btnSubmit1" type="submit" runat="server" value="Submit" /> <!-- WORKS! -->
            <button it="btnSubmit2" type="submit" runat="server">Submit</button> <!-- DOESN T WORK -->
        </form>
    </body>
</html>
问题回答

似乎以这种方式设计:

// when a submitHandler is used, capture the submitting button
if (validator.settings.submitHandler) {
  inputsAndButtons.filter(":submit").click(function () {
    validator.submitButton = this;
  });
}

不幸的是,这似乎已经失败,没有其他选择。

The :submit selectedor general applicable to button or content elements. 请注意,有些浏览器将内容作为<条码> 类型=“default”,而另一些浏览器(如互联网探索者)则不使用。

一种解决办法是将<条码>丁顿与援引该项确认的职能联系起来。 在下面的例子中,我们看到正在以一个支柱来做到这一点:

$("#myform").validate();
$("a.check").click(function() {
  $("#myform").valid();
});




相关问题
Bind Button.IsEnabled to custom validation with XAML?

I am sorry I didn t know how to title my question any better, you name it if you got a good 1. I have an entity Contact. this person has navigation properties: Address, Phones (A collection of Phone)....

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

Rails 101 | validates_currency?

I ve searched high and low, but I could not find a solution, to what I think seems like a very common task. In a form I want to have a text input that accepts currency strings (i.e. $1,000,000 or ...

CodeIgniter form verification and class

I m using the form validation library and have something like this in the view <p> <label for="NAME">Name <span class="required">*</span></label> <?...

热门标签