parsley.js

Select2 validate and force user to select ast least X items

大憨熊 提交于 2019-12-13 06:43:39
问题 I'm having some trouble trying to do some custom validation with a select2 jQuery plugin I need to force user to select at least 2 items from the list . The select2 plugin has a property maximumSelectionSize that allows user to select up to X items from the list, but it does not have the "inverse" property. Also the required tag won't work because I need user to select more than one item. As I'm working developing a custom validator with parsley validation plugin, I'd need to know how to get

Parsley.JS - Get an error list using callback

。_饼干妹妹 提交于 2019-12-12 14:43:10
问题 In my project I don't want to display HTML errors, but throw an alert() with list of errors on formSubmit. I guess this should be done somehow by using listeners:onFormSubmit callback, however none of passed variables does not contain "clean" version of errors. Parsley documentation also lacks of this feature. 回答1: As of version 2.8.0, you can access the error messages via fieldInstance.getErrorsMessages() Example: <form method="post" id="myForm"> <input type="text" name="phone" value=""

parsley.js catching all errors and outputting via a javascript alert()

半腔热情 提交于 2019-12-12 10:22:42
问题 I want to catch all errors on a form using pasley v2.8 in a single event and then display those errors via a standard javascript alert. I had this working in part before thanks to assistance in this SO question about the fieldinstance functionality. However the code in that other question works with a function being called as every form element fails. What I want is an event that fires just once after all the errors have been collated. I believe this is done via the recent form:error event.

Parsley form will not validate

两盒软妹~` 提交于 2019-12-12 05:25:55
问题 I've tried to duplicate the sample bootstrap/parsley form in jsfiddle with bootstrap 3 parsley 2.2.0-rc4 http://jsfiddle.net/bwolfsohn/9wfjo94w/14/ the form pops up the message: Yay, everything seems to be ok.. then errors out with: {"error": "Shell form does not validate{'html_initial_name': u'initial-js_lib', 'form': <mooshell.forms.ShellForm object at 0x2971b90>, 'html_name': 'js_lib', 'html_initial_id': u'initial-id_js_lib', 'label': u'Js lib', 'field': <django.forms.models

Display loading gif after parsley.js validates form

点点圈 提交于 2019-12-12 04:40:02
问题 Have a an upload form with some required fields which uses parsley.js to validate. I want to display a loading gif after the form has been validated and the actual uploading starts. I've tried using an onsubmit event to call a function which changes the visibility of the loading gif from hidden to visible. But the gif shows up when ever the upload button is clicked even if the form has not been validated. Thanks in advance! 回答1: You'll have to use Parsley events (http://parsleyjs.org/doc

Custom Parsley.js asynchronous validator loops twice

蹲街弑〆低调 提交于 2019-12-12 04:20:00
问题 I have been figuring this out for the whole afternoon and I can't seem to be able to debug this. The problem is that when I do a hard refresh of the page (document ready fires) my custom async validator runs twice but only posts one time to the server. window.Parsley.addAsyncValidator('emailvalidation', function (data) { console.log("Runs"); var myResponseText = data.responseText; var obj = jQuery.parseJSON(myResponseText); valid = (obj.result == 1); return valid; }, '/check.do?action

Console-msg: “Parsley's pubsub module is deprecated; use the corresponding jQuery event method instead”

怎甘沉沦 提交于 2019-12-12 03:33:42
问题 Trying to display error-msgs in a Bootstrap-Popup, I found a solution from TheDude and have adjusted the event-names for ps2.1: $.listen('field:error', function (fieldInstance) { arrErrorMsg = ParsleyUI.getErrorsMessages(fieldInstance); errorMsg = arrErrorMsg.join(';'); fieldInstance.$element .popover('destroy') .popover({ container: 'body', placement: 'right', content: errorMsg }) .popover('show'); }); $.listen('field:success', function (fieldInstance) { fieldInstance.$element.popover(

parsley 2.0.3 not working with boostrap 3

谁都会走 提交于 2019-12-12 02:04:33
问题 i am trying to use parsely.js on my html page to validate input box. currently this html page contains one input box and one submit button. the structure is created using bootstrap 3 and this page does not contain Form tag. <div role='form'> <div class="row form-group"> <div class="col-xs-3"> <label title="fullname">Full Name</label> </div> <div class="col-xs-4"> <input type="text" class='form-control' id="name" name="fullName" data-parsley-required="true" data-parsley-required-message=

Enforce strong password policy with parsley.js

好久不见. 提交于 2019-12-11 23:45:16
问题 I have a password field that i will like to ensure that the users input a password that will meet the criteria stated below:- Must contain at least one capital letter Must contain at least one small letter Must contain a number and lastly A special character like #%@!*(()+= ( optional ) I have tried to use the data-parsley-pattern, and data-parsley-type but not getting the required results. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src=

ParlseyJS - remove validation from disabled fields

拜拜、爱过 提交于 2019-12-11 18:15:44
问题 just started using ParlseyJS for some new work we are doing. I am having an issue whereby I hide and disable a bunch of dropdown lists based on a dropdown value (in a form). When I submit this form, these fields continue to be validated. These fields are being disabled via jQuery as such: minage.removeAttr('data-parsley-minagecheck').attr('data-parsley-excluded', '').attr('disabled', 'disabled'); maxage.removeAttr('data-parsley-maxagecheck').attr('data-parsley-excluded', '').attr('disabled',