parsley.js

Parsley Remote and Additional Parameters

ぃ、小莉子 提交于 2019-12-20 03:07:48
问题 I am trying to use the remote validator with Parsley and I can't seem to send additional data with the request. The field in question is an email field, and I want to send it to the server to see if the email address is 'available'. In addition, I need to send an id parameter which the server requires. The id parameter is embedded in my form in the 'host' field. So, I have tried using the Parsley DOM API as follows: <input type="text" class="form-control" tabindex="15" id="email" name='email'

Configure Parsley using Javascript, not html data attributes

匆匆过客 提交于 2019-12-20 01:45:44
问题 How do I configure Parsley using javascript, not html data attributes? The documentation examples show how to configure the Parsley form instance and some global field options using JS, but I want to be able to add and configure all field instances that way too. I don't want to use the html data attributes. Is that possible? I think this question is driving at the same problem, How to use ParsleyJS 2.* using javascript and not data attributes, but it's not 100% clear. 回答1: @kim-prince Hope

Parsley JS 2.x - how do you validate hidden fields?

独自空忆成欢 提交于 2019-12-19 04:05:13
问题 I would like to validate hidden fields, so essentially I want to remove input[type=hidden] from parsley's list of excluded form elements. I've tried explicitly setting excluded elements in parsley's options, but hidden fields are still not validated. E.g: $(element).parsley({ excluded: 'input[type=button], input[type=submit]' }); Any thoughts on how to accomplish this, or what I'm doing wrong? 回答1: I'm guessing this is a bug. Take this form: <form method="post" id="myForm"> <input type="text"

Validate set of fields only if radio button is checked (conditional validation)

假装没事ソ 提交于 2019-12-19 03:34:44
问题 I have a form with two sets of fields: "Contact information" (17 fields) "Company information" (5 fields) There is a radio with the question "Do you have a company?" that is related to the company information. If the radio is "Yes", the company fields must be filled and validated. If the radio is "No", the company fields should be ignored. I'm not sure about the best way to manage this problem. By switching the attribute disabled of the company fields according to the state of the radio

Validate set of fields only if radio button is checked (conditional validation)

风流意气都作罢 提交于 2019-12-19 03:32:13
问题 I have a form with two sets of fields: "Contact information" (17 fields) "Company information" (5 fields) There is a radio with the question "Do you have a company?" that is related to the company information. If the radio is "Yes", the company fields must be filled and validated. If the radio is "No", the company fields should be ignored. I'm not sure about the best way to manage this problem. By switching the attribute disabled of the company fields according to the state of the radio

Asynchronous form submission with parsley.js

烂漫一生 提交于 2019-12-18 13:24:06
问题 I'm trying to create a form that is validated front end using Parsley.js and submitted asynchronously. The form is called #contactForm and the submit button is #sendData, the error comes when I hit submit on an empty or invalid form. I expect to see an 'Error' alert from invalid form data but instead it just continues with the Else condition and the data is processed by contactForm.php. $(document).ready(function() { // submit data on click and check if valid $('#sendData').click(function(e)

Trigger parsley validation without submit form?

柔情痞子 提交于 2019-12-18 12:53:15
问题 Given this code, it never works and always returns true whatsoever ? <form id="my-form" data-validate="parsley"> <p> <label for="username">Username * :</label> <input type="text" id="username" name="username" data-required="true" > </p> <p> <label for="email">Email Address * :</label> <input type="text" id="email" name="email" data-required="true" > </p> <br/> <!-- Validate all the form fields by clicking this button --> <a class="btn btn-danger" id="validate" >Validate All</a> </form>

parsley form not submitting when submit button has name=“submit”

妖精的绣舞 提交于 2019-12-18 09:08:21
问题 I just discovered that my form isn't submitting when i give the submit element the name="submit" attribute. When I change the the name to something else, it works perfectly! I am using parsley.remote.min.js * Version 2.0.3 - built Mon Jul 21 2014 11:58:33 Sorry I cannot provide code right now, I just wanted to throw that out there. Is it possibly I am doing something wrong? 回答1: When you name a form element "submit", you inadvertently override the form's submit method with an input object.

Validate Chosen Multi Selection with Parsley.js

六眼飞鱼酱① 提交于 2019-12-13 21:27:38
问题 I managed to get parsleyjs.org validate a "required" Chosen dropdown but I can't seem to be able to validate the Multi selection dropdown. I have tried to apply the max and min validation rules, that did not work. I have setup parsleyjs.org and Choosen on a test site here: http://loai.directory/test/test/blank.php How can I validate min and max on a multi selection dropdwon with parsleyjs? 回答1: You should use data-parsley-mincheck for that. The following example works as expected (jsfiddle

How to configure a Parsley custom remote using javascript, not attributes

一世执手 提交于 2019-12-13 06:54:32
问题 Similarly to this question and this question I can't figure out how to How to configure a Parsley custom remote using Javascript, when binding an individual field. e.g. I'm trying (simplified): $('#field').parsley({ remote: true, remoteValidator: 'mycustom'; }); being the equivalent of the example: <input name="q" type="text" data-parsley-remote data-parsley-remote-validator='mycustom' value="foo" /> after I've registered the example remote: window.Parsley.addAsyncValidator('mycustom',