jquery-validate

ASP.NET WebForms & jQuery Validate's remote method

╄→гoц情女王★ 提交于 2019-12-25 02:55:36
问题 Can anyone please tell me how I can get an ASP.NET WebMethod to return correctly-formatted data for display by jQuery Validate? Here's my code: Client-side code $('#txtUName').rules('add', { remote: { type: 'POST', url: 'Register.aspx/ValidateUserNameOrEmail', contentType: 'application/json; charset=utf-8', data: JSON.stringify({ 'data' : $('#txtUName').val(), 'valUser' : true }), dataFilter: function(result) { return $.parseJSON(result).d; }, dataType: 'json' } }); Server-side code

jQuery Validation not getting options

半城伤御伤魂 提交于 2019-12-25 02:53:54
问题 I'm trying to customise my form validation with no success. Nor message nor custom error class is firing when I test. Still, it seems to work, since it shows the standard error message after the invalid field. My code: HTML <form role="form" method="POST" id="account-edit"> <div class="box-body"> <div class="form-group"> <label for="address">Address</label> <input type="text" class="form-control" id="address" name="address" placeholder="Endereço"> </div> <div class="form-group"> <label for=

jQuery validation addmethod always return false

≯℡__Kan透↙ 提交于 2019-12-25 02:48:15
问题 I am using jQuery 1.7.2 and jQuery validation 1.8.2 I added ajax which I check response all correct value is also passing correct but still I am not getting validation. This is my code <script type="text/javascript"> $(document).ready(function () { var validator = $("#form1").validate({ rules: { ctl00$ContentPlaceHolder$txCivilID: { required: true, rangelength: [12,12], digits: true, checkCivilID: true }, ctl00$ContentPlaceHolder$txFirstName: { required: true }, ctl00$ContentPlaceHolder

Jquery validation plugin does not send POST data

ぃ、小莉子 提交于 2019-12-25 02:47:09
问题 Update 2: I found out what was wrong! There was a 301 redirect in the .htaccess file. I will post it as an answer once I am allowed to (users under 10 rep have to wait 8 hours). Update: I have taken Barmar's suggestion and checked the network tab (a tab I'm not too familiar with) and noticed I am receiving a 301 from handle.php See screenshot. I am going to do some searching and post my results. Original Post: I am using the JQuery validation plugin to validate and send form data via ajax.

Jquery validation plugin does not send POST data

[亡魂溺海] 提交于 2019-12-25 02:47:01
问题 Update 2: I found out what was wrong! There was a 301 redirect in the .htaccess file. I will post it as an answer once I am allowed to (users under 10 rep have to wait 8 hours). Update: I have taken Barmar's suggestion and checked the network tab (a tab I'm not too familiar with) and noticed I am receiving a 301 from handle.php See screenshot. I am going to do some searching and post my results. Original Post: I am using the JQuery validation plugin to validate and send form data via ajax.

How to style jquery validation (http://jqueryvalidation.org/)?

别说谁变了你拦得住时间么 提交于 2019-12-25 02:46:45
问题 I'm looking for some sort of reference but I can't find it. All I can find are bits of styling as asked in stackoverflow or mini-examples. Nothing really comprehensive. Also there are other jquery validation plugins and some of the discussion (mostly here in stackoverflow) I've seen doesn't really talk about which plugin is being used. I have this code (see below) without using any CSS and and it produces this sort of styling by default. I looked at the site linked above and can't find any

Validate an inline jquery Datepicker using jquery validation

瘦欲@ 提交于 2019-12-25 02:18:53
问题 I am trying to ensure that a date has been selected using my inline datepicker.The inline datepicker feeds a hidden input box, so it's tough to require that. To try to get the message to display, I have relocated my error messages using invalidHandler. My code: <script type="text/javascript"> jQuery('#date').datepicker({ inline: true, beforeShowDay: checkDayOfWeek, onSelect: function(dateText, inst) { $("#ship_date").val(dateText); } }); </script> <div id="date" style="font-size: 75%;" class=

jQuery Validate: Change required message using select option

此生再无相见时 提交于 2019-12-25 02:08:35
问题 I've been trying to change the message of the required rule for my form dynamically when the user changes the select option input. I can't seem to get anything to work properly. The message will never change after the selection is changed. I try my methods using the change function for the select input like so: $('#selector').change(function(){ Method X; } Methods I've tried: $.validator.messages.required = "New Message"; $('#inputx').rules("remove", "required"); $('#inputx').rules("add", {

Validate dynamically generated form with jQuery Validator

寵の児 提交于 2019-12-25 02:01:21
问题 Sorry for keep asking this, but I just can't figure it out. I've reduced the question to just the bare minimum. How can I validate a dynamically generated form? Below is my attempt, but as seen, it shows up as passing validation. https://jsfiddle.net/j2pgobze/1/ <form id="myForm"> <input type="text" name="email" id="email" value="bademail" > </form> <button id="validate">validate</button> var myValidateObj = { rules: { email: { email: true } } }; $(function () { jQuery.validator.setDefaults({

checking for any occurrence of special characters with jQuery

≡放荡痞女 提交于 2019-12-25 01:43:35
问题 If I have a set of special characters like: !@#$%^&*(){}[]<>?/|- how could I check for existence of any of these in a string ( or field value)? Trying to add a method jQuery validator plugin that would reject the field if any of them are present. I realize this is asking for a lot, regex is just killing me. 回答1: Try this: /[!@#$%\^&*(){}[\]<>?/|\-]/ You only need to escape the ] . Inside a character class ( [] ), the other characters are interpreted literally. More info: http://www.regular