parsley.js

Erroneous placement of error message span with Parsley 2.x and Bootstrap 3

青春壹個敷衍的年華 提交于 2019-12-05 11:38:52
I'm trying to add Parsley validation to a set of radio buttons contained within a Bootstrap 3 btn-group. The issue is that the error wrapper that parsley injects (in my case set to a span) is appearing in between the two options (which are contained within a label) rather that outside the btn-group div. This is illustrated in the sample below: <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <label class="btn btn-default"><input type="radio" name="BuyAgain" value="True" data-parsley-required="true" data-parsley-multiple="BuyAgain" data-parsley-id="3282">Yes</label> <span

Getting Parsley 2.x working with Bootstrap 3 correctly

别说谁变了你拦得住时间么 提交于 2019-12-05 10:28:39
问题 I am using Twitter Bootstrap 3.1.1 with Parsley v2.0.0-rc3 . I made it mostly work apart from classHandler option. I have HTML like this: <div class="form-group"> <label class="control-label" for="username">User Name</label> <input class="form-control" id="username" name="username" required="" type="text" value=""> </div> And run Parsley like this: $("#register_form").parsley({ successClass: "has-success", errorClass: "has-error", classHandler: function(el) { return $(el).closest(".form-group

parsley.js telephone digits input validating with spaces

别说谁变了你拦得住时间么 提交于 2019-12-05 07:19:18
I have an input for telephone number. I would like to write this format: 0175 6565 6262 (with spaces). But if write with " " spaces so get error and I write without spaces so get not error. Here my HTML Input: <input type="text" data-parsley-minlength="6" data-parsley-minlength-message="minlength six number" data-parsley-type="digits" data-parsley-type-message="only numbers" class="input_text" value=""> Hope someone can help me? That's a great answer, but it's a bit too narrow for my needs. Input field should be tolerant of all potential inputs – periods, hyphens, parentheses, spaces in

parsley js - conditional required if checkbox checked

老子叫甜甜 提交于 2019-12-05 05:46:21
Is there an easy way with parsleyjs to make a field required depending on another field? See my js fiddle here http://jsfiddle.net/marksteggles/wbhLq0t4/1/ <form data-parsley-validate="true"> <div class="form-group"> <label> <input name="request_signature" type="checkbox" />Require signature</label> <div class="request_signature_fields"> <textarea class="form-control required" name="signature_reason" rows="3"></textarea> </div> </div> <input class="btn btn-success" name="commit" type="submit" value="Send" /> </form> There is no easy way yet (see this and this ). You can either toggle the

Parsley.js 1.x - Error when form data attributes are changed on the fly

旧巷老猫 提交于 2019-12-04 18:28:48
My Parsley error message on the first keyup event when typing into field #myTestField is This value is too short. It should have 4 characters or more. I tryed to change Parsley field data attributes on the fly, but it seems this doesn't work. It keeps the value assigned in first place (html form) without taking in account the modified one in the JS code. On Chrome I can check that the data attribute value is changed after the DOM is loaded. My code is <form name="myForm" id="myForm"> <input type="text" name="myTestField" id="myTestField" data-trigger="keyup" data-minlength="4" data-validation

Parsley.js - change error container

青春壹個敷衍的年華 提交于 2019-12-04 17:37:49
问题 I want to alter the positioning of each error message. That is display the error message in the respective <div class="errorBlock"></div> . By using the documentation's code the the error msg is displayed before the element (input) and not displayed as expected. Any ideas? As per documentation: errors: { container: function (element, isRadioOrCheckbox) { var $container = element.parent().find(".parsley-container"); if ($container.length === 0) { $container = $("<div class='parsley-container'>

Parsley.js error message

南笙酒味 提交于 2019-12-04 15:52:26
I am using parsley.js from http://parsleyjs.org/ . Wanted to get the error message from the call back function (onFieldError) and place the value inside a twitter bootstrap popover. In order to do so, I'll need to place it inside the data-content attribute of the popover instead of a div. Can any one tell me how to do this or fix this. onFieldError: function ( elem, constraints, ParsleyField ) {} These are the only parameters that are available. If you look in parsley.js source file, you'll see that there is an errors object config at the bottom of the file that allows you to have control over

Parsley.js - Display errors near fields AND in a combined list above form

試著忘記壹切 提交于 2019-12-04 13:35:02
问题 Is it possible to configure Parsley.js to display its error messages both... a) next to individual fields, AND b) in a combined list elsewhere on the page ...at the same time? Also, is it possible to render error messages with a hyperlink back to the field that generated the error? Thanks. UPDATE: The accepted answer is a fantastic example (thanks milz!) but it needed a bit more refining. For the benefit of other readers, here's my updated code in which... Error messages no longer duplicate

Parsley Form Validation - Event Listeners

丶灬走出姿态 提交于 2019-12-04 13:24:36
Ok, so i have searched everywhere for this but still can't get it working. No one seems to have tried it but i'm sure it can do it. I want to use the Parsley validation plugin with my twitter bootstrap project. I have read the docs, but am still learning JQuery so it's going right over my head (i'm rationalising that it is too advanced for me at the moment). I want to add a custom event listener to Parsley to show a popup on error instead of the ugly li's. This is what i have tried: JQUERY $(document).ready(function () { $('.parsley').parsley({ successClass: 'success', errorClass: 'error',

Parsley.js - Validate optional input for only numbers

不想你离开。 提交于 2019-12-04 03:40:48
I have a form that has one optional input and 3 required input fields. For the optional input I have the below markup: <input type="number" placeholder="0" min="0" max="20000" step="100" data-parsley-validation-threshold="1" data-parsley-trigger="keyup"> This does not fire the validation if I have type in letters or any other characters. It does validate for min and max values. If I put required attribute it does seem to work but I don't want that. I also tried defining a pattern as below: data-parsley-pattern="^[0-9]*$" None of them seem to work. Any ideas? You can use data-parsley-type=