简体   繁体   English

jQuery表单验证不包含“提交”按钮的值

[英]jQuery form Validation does not include value of submit button

I'm using jquery form validation from http://www.runningcoder.org/jqueryvalidation/ 我正在使用来自http://www.runningcoder.org/jqueryvalidation/的 jquery表单验证

demo.html demo.html

<form id="form-signup_v1" name="form-signup_v1" method="get" class="validation-form-container">
<div class="field">
    <label for="signup_v1-username">First Name</label>
    <div class="ui left labeled input">
        <input id="first_name" name="first_name" type="text">
        <div class="ui corner label">
            <i class="asterisk icon">*</i>
        </div>
    </div>
</div>
<input name="ok" id="ok" type="submit" class="ui blue submit button" value="Ok">
<input name="cancel" id="cancel" type="submit" class="ui blue submit button" value="Cancel">
</form>

<script>
$('#form-signup_v1').validate({
    submit: {
        settings: {
            inputContainer: '.field'
        }
    }
});
</script>

I'm use form validation in the url not include the value of submit button 我在网址中使用表单验证,但不包含“提交”按钮的值

demo.html?first_name=John

在此处输入图片说明

I try to remove jquery form validation in the url include the value of submit button 我尝试删除包含提交按钮的值的URL中的jQuery表单验证

demo.html?first_name=John&ok=OK

在此处输入图片说明

I want to check submit button when click from query string but when i use validation the url alway not include query string of button like the figure 1 我想检查从查询字符串中单击时的提交按钮,但是当我使用验证时,URL始终不包括按钮的查询字符串,如图1所示

If you want that the query doesn't include the button name just remove the name attribute from <input type = "button" name="ok"> . 如果您希望查询不包括按钮名称,只需从<input type = "button" name="ok">删除name属性。 Also assign a value to the button. 同时为按钮分配一个值。 By default the submit action forms the query string from the name value pairs in the form. 默认情况下,submit操作从表单中的名称值对形成查询字符串。

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form action="get"> <input name="first_name" type="text" /> <input type="submit" value="button"> </form> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM