jquery-validate

Remove 'required' from checkbox when an input is filled with jQuery Validate plugin

我与影子孤独终老i 提交于 2019-12-31 04:58:29
问题 So im doing a contact form with several text inputs and checkboxes and validating with the jQuery Validate plugin, and what i want to achieve is this: When the text input is filled, the 'required' attribute from the rules of the plugin aplied on the checkboxes get removed. This is my HTML(inside a bootstrap modal: <div id="invitoUno" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header" style="height: 0; border

event.preventDefault() does not work in Chrome and Opera

独自空忆成欢 提交于 2019-12-31 04:50:14
问题 I am using jQuery Validation Plugin 1.9.0 with jQuery 1.7.2. I want my form to be validated with jquery validation plugin. It works fine in Firefox 20.0.1 and IE 10. But in Chrome (26.0.1410.64 m) and in Opera (12.14) I cannot click on cancel in my form without preventing validation to be done. This is my javascript code: submitHandler: function(form) { if (this.submitButton.value != 'cancel') { $(form).hide(); $('#load').show(); $(form).submit(); } else { event.preventDefault(); } } When I

How to customize error message using jQuery.validator placeholders?

六眼飞鱼酱① 提交于 2019-12-31 04:21:26
问题 I'm trying to add custom form validators. And I'm stuck with message customizing issue. Let's say I want to check if field value does not exceeds max allowed value. I know that 'Validation Plugin' has a "max" validator already - this is just for sample: $.validator.addMethod("max-numeric", function(value, element, param) { var maxValue = $(element).attr("data-max"); return (!maxValue) || maxValue >= value; }, $.validator.format('Applicants must be older than {0} and younger than {1} years of

Centralize some error messages from my form

a 夏天 提交于 2019-12-31 04:08:31
问题 Currently, I'm using errorPlacement to print error message for each input : $('#my_form').validate({ errorPlacement: function(error, element) { // Some code that print error below each inputs }, ... Then, I tried to centralize errors messages with showErrors , like this : showErrors: function(errorMap, errorList) { // Some code that centralize each error for each input in one place }, ... }); It works fine, except that now I would like to centralize only some errors messages of my form , not

jQuery dynamic validation

余生颓废 提交于 2019-12-31 03:31:18
问题 Hi there Im trying to do a few things with jQuery validation plugin and seems stuck on one place. Here is some code: <script type="text/javascript"> $(document).ready(function(){ $('#myform').validate(); $('#email').rules('add', {required: true, messages: {required: 'email is required'}} ); $('#phone').rules('add', {required: true, messages: {required: 'phone is required'}} ); $('#validate').click(function(){ $('#result').text($('#myform').validate().form()); return false; }); }); </script>

How to use jQuery Validate form validation with dropkick select elements (DIV based select form element)

烂漫一生 提交于 2019-12-31 03:19:12
问题 I want to use jQuery validate library on a div based select form element. I am using the dropkick library to beautify my selects, but I am having difficulties trying to validate the form due to my select elements getting re-created with DIVS. <select id="permissionGroup" class="dropkick" name="permissionGroup" style="display: none;"> <option selected="selected" value=""> Please Select </option> <option value="1"> Admin </option> <option value="2"> Auditor </option> </select> The above select

jQuery validation plugin multiple forms

与世无争的帅哥 提交于 2019-12-31 02:52:15
问题 I'm trying to add some functionality to a series of forms to validate two checkboxes. I'm using the jQuery validation plugin and for the life of me can't get it working. In fiddle I just get a 403 forbidden message when I submit it. On my actual site it looks like its never even executed. HTML - These forms are multiple and identical per page. Stackoverflow only lets me show one though <form method="post" id="offer" name="offer" action="#" class="offer"> <input type="text" name="original

Problem with jQuery validate plugin (remote validation)

ⅰ亾dé卋堺 提交于 2019-12-31 01:32:08
问题 I have a problem trying to validate a user value using the jQuery Validation plugin. The validation seems to fire correctly and call the web service function exactly as I want but, even if the server function does work correctly and returns a true / false result the field is always invalid. This is the validation code on the client side $('#myForm').validate({ errorContainer: container, errorLabelContainer: $("ol", container), wrapper: 'li', meta: "validate", rules: { Code: { required: true,

Onclick validate form, if valid only submit form

筅森魡賤 提交于 2019-12-30 10:49:32
问题 I have an html form that I first wish to validate with jQuery validation library jquery.validate.min.js and if form is valid , submit the form to a location. I have attempted the following: <html> <head> <link rel="stylesheet" href="../../common/view/css/bootstrap.min.css" type="text/css"> <script src="../../common/view/js/jquery.js"></script> <script src="../../common/view/js/bootstrap.min.js"></script> <script src="../../common/view/js/jquery.validate.min.js"></script> </head> <body> <form

jQuery validator plugin without using form [duplicate]

人走茶凉 提交于 2019-12-30 09:54:13
问题 This question already has answers here : Validate inputs that are not inside a form with jQuery Validation plugin [closed] (2 answers) Closed 5 years ago . I have multiple section is asp.net that submits data in chunk and i want to use jquery validation plugin, but issue is that asp.net wraps everything in form and child forms not wokring right and technically incorrect. So only alternative is forget about form and implement validation for divs. But all sames i see are using form. As not