jquery-validate

jQuery Validation: validate atleast one checkbox is selected from a list where names are different

流过昼夜 提交于 2020-01-04 07:44:56
问题 I need to validate that atleast one check box is selected from a list of checkboxes using jQuery Validation Plugin. Since the checkboxes are part of a ASP.NET GridView Control, the names of these checkboxes will be different, which makes setting up the rules for the validation plugin complex since it expects the name for the rule. I have searched around and found the below questions Question 1710486 Question 1136507 I think the first question is a much better solution, but i still feel that

jQuery validation works with input type=“submit”, but not html button element. Why?

二次信任 提交于 2020-01-04 04:23:05
问题 Using ASP.NET, why is it that the bassistance.de jQuery validation plugin prevents form submission when using input type="submit" elements, and not html button elements? The validation fires when using an html button (type="submit") tag, but the form is still submitted. Is there a way to make the jQuery validation plugin work with html button elements? A quick example: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script type="text/javascript"> $(document).ready(function

returning a string with remote using the jquery validate plugin

浪尽此生 提交于 2020-01-04 03:59:29
问题 From the jquery documentation, describing the remote function of the jquery validate plugin: The response is evaluated as JSON and must be true for valid elements, and can be any false, undefined or null for invalid elements, using the default message; or a string, eg. "That name is already taken, try peter123 instead" to display as the error message. I have a php page that echo's a response, and it works as described if I use echo("true") or echo("false"). However, whenever I echo a string,

jquery validate - groups and their labels

亡梦爱人 提交于 2020-01-04 02:51:26
问题 Good morning I have been using the jquery validate function for a while and it's great. However, wondering if its possible to have the group error label only clear out once BOTH (or 3 or 4) elements in the group are correct. For example, if I have an empty first and last name in a group, the error goes away once I type in just the first name. I know I can disable the onfocusout function, but I would rather not. Thank you! 回答1: This does indeed look like a bug in jQuery validate (you could

JQuery Validation Plugin submitHandler doesnt work for me

泪湿孤枕 提交于 2020-01-04 02:34:16
问题 Hello i got the following issue my following code doesn't work for me and i cant figure out why. I hope you guys can help me. Edit: The submit handler simply doesn't get called. I don't even get the alert message. I wanted to disable the submit button till the form is validated. $('form').validate({ onsubmit: true, debug: true, errorLabelContainer: "#errorBox", rules: { user_email: { minlength: 4, email: true, required: true }, user_textField: { minlength: 3, required: true }, user_phone: {

Bootstrap & Form Validation

霸气de小男生 提交于 2020-01-03 06:39:27
问题 I am using Bootstrap for the first time & trying to do some form validation using jQuery but they aren't working. Can somebody point out the reason? Instead of basic bootstrap, I am using one of the themes of bootstrap from bootswatch.com... <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)"> <meta name="dcterms.created" content="Sat, 05 Mar 2016 11:40:35 GMT"> <meta name="description" content=""> <meta

How to properly integrate tooltips with jQuery Validate

梦想与她 提交于 2020-01-03 04:47:07
问题 I have the following code for displaying a validation error in a tooltip: <form name="NATIPRangeForm"> <div class="input-group"> <strong class="ip-value-title">Base Address:</strong> <input class="ip-input" type="number" id="ip_seg_1" name="ip" ng-model="nat.ip.seg1" min="0" max="255" required>. <input class="ip-input" type="number" id="ip_seg_2" name="ip" ng-model="nat.ip.seg2" min="0" max="255" required>. <input class="ip-input" type="number" id="ip_seg_3" name="ip" ng-model="nat.ip.seg3"

Making the JQuery Validation plugin evaluation non-lazy

邮差的信 提交于 2020-01-03 04:29:08
问题 According to the documentation for the JQuery validation plugin: the validation is lazy: Before submitting the form for the first time, the user can tab through fields without getting annoying messages Is there any way to display the messages as the user tabs through the form? Cheers 回答1: You can override the default onfocusout to do more eager/pre-submit validation you want, like this: $(function() { $("form").validate({ rules: { ...rules... }, messages: { ...messages... }, onfocusout:

Disable jQuery Validate plugin

心不动则不痛 提交于 2020-01-03 04:23:27
问题 I'm completing a form using Web driver and need to bypass two form fields by using browser.execute_script() to insert a hidden form field into the DOM. However I also need to disable existing validation methods in order to submit the form. The form uses jQuery Validate. Can anybody advise how to disable part or all of jQuery Validate? I tried using the following, but I get the error TypeError: d is undefined b.execute_script(' $("firstMemorableCharacter").rules("remove"); $(

Jquery Validation remote validation not working

早过忘川 提交于 2020-01-03 03:31:11
问题 I am not sure what I am doing wrong. I am using the Jquery.Validate plugin and it has a remote field, so I did this: $("#mainForm").validate( { rules: { UserName: { required: true ,remote: "Test" } ,messages: { UserName: { remote: "UserName has already been chosen. Please choose another one" } } } The required works fine. It's the remote that has the problem. I am using asp.net MVC and the path is right - it hits my method public bool Test(string userName) { return false; } It returns false