formvalidation-plugin


How to dynamically change validators at runtime


Let's say I have this validation in one field:
between: {
min: 50,
max: 500,
message: 'Please enter correct range'
}
I would like to update min and max at runtime.
How can I do that ?
Thanks.
You can do that using the updateOption method.
See the following code:
$('#yourForm')
// Update min & max options
.formValidation('updateOption', 'yourInputName', 'between', 'min', 10)
.formValidation('updateOption', 'yourInputName', 'between', 'max', 90)
// Update message if you need to
.formValidation('updateOption', 'yourInputName', 'between', 'message', 'Your new message')
// You might need to revalidate field
.formValidation('revalidateField', 'yourInputName');
# Working example:
http://jsfiddle.net/Arkni/241jzc46/
# Refferences:
updateOption docs: http://formvalidation.io/api/#update-option

Related Links

How to dynamically change validators at runtime
Change locale dynamically after plugin is applied

Categories

HOME
json
ajax
payment-gateway
elixir
tinyos
filterrific
freepascal
jbehave
json-ld
qpython3
apollo
vlc
branch.io
jrebel
tumblr
docker-windows
avl-tree
pygame
internet-explorer-11
jframe
actionscript-2
goutte
cockroachdb
google-shopping
xul
onsen-ui2
qt-installer
netezza
opera-mini
flexboxgrid
autolayout
jflex
rhandsontable
pptp
sharp
pep8-assembly
clockwork
picturebox
edb
ocs
honeysql
boilerplate
autocompletetextview
strstr
code-behind
fltk
visualstudio.testtools
restful-url
ssh.net
jupyter-console
taskmanager
gist
spring-data-hadoop
rollback
jexl
in-memory-database
static-code-analysis
collapsingtoolbarlayout
qos
garrys-mod
barcode-printing
keycode
spring-ioc
icefaces
excon
spring-repositories
dac
django-south
usb-drive
qt-linguist
eml
hateoas
lemoon
datainputstream
jenkins-scriptler
programming-paradigms
mogrify
type-mismatch
ubercart
sparse-file
pgm
apache-mina
inputaccessoryview
java-melody
json-patch
facebook-chat
confusion-matrix
.net-cf-3.5
dllexport
iconv
dynamics-ax-2009
fraud-prevention
domain-calculus
mvs
xgettext
driving-directions
viewdidload
handwriting
dashcode
squeel
querypath
osx-leopard
webrat

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App