2.3 KiB
2.3 KiB
UPGRADE FROM 1.x to 2.0
General
- default namespace is now
data-parsley-for DOM-API (not anymore 1.2.xparsley-or 1.1.xdata-) - there is only one global
ParsleyValidatorinstance. Adding / removing validators is not made onParsleyFormorParsleyFieldinstances anymore, but directly againstParsleyValidator. Same goes for errors messages.
Options / Configuration
optionsis now a flat 1 dim depth object.- These options have been removed:
listenersvalidatorsuseHtml5ConstraintsmessagesvalidateIfUnchanged
- These options have been renamed:
validationMinlengthintovalidationTresholderrors.classHandlerintoclassHandlererrors.containerintoerrorsContainererrors.errorsWrapperintoerrorsWrappererrors.errorElemeintoerrorTemplate
Validators
requiredvalidator now acceptsfalsevalue and becomes inactive.rangelengthvalidator is now renamed aslength. Same requirements.rangecheckvalidator is now renamed ascheck. Same requirements.notnull,type="urlstrict",type="tel"have disappeared from built-in validators.- types
phone,urlstrict,dateIsohave been removed. They could be crafted and submitted by someone inextra/
UI/UX
.parsley-validatedclass is not added anymore on bound fieldsnovalidateattr is now automatically added to<form>.parsley-error-listis now.parsley-errors-list- to customize
typevalidator error message, you do not need to add the precise type anymore. eg:parsley-type-email-message="msg"becomesdata-parsley-type-message="msg"
Javascript
.parsley('method')API is deprecated. Use .parsley().method() now eg:$('#form').parsley('validate')is now$('#form').parsley().validate()
Listeners
- can now be global with
$.listen()and listen for every Parsley instance firing it (the wayParsleyUIworks) - can be Field / Form specific by using
.subscribe()and.unsubscribe()on a Parsley instance.
Misc
- parsley
remotevalidator is shipped now in parsley.remote.js - parsley.extend is no more. Instead, extra validators are now placed in a dir and can be built with a script into a single file.