formvalidation-plugin


Change locale dynamically after plugin is applied


How can I change locale after the plugin has been applied?
Let say I have "en_US" locale assigned. Now I want to change it on runtime.
I tried to re-apply plugin to element:
$(element).formValidation({locale: 'es_ES',....});
But no effect. Any idea?
How can I refresh the view?
EDIT: 2015-06-18
Before you follow the solution bellow (step 1 & step 2 (option 3)), make sure that you downloaded the i18n add-on from here, this add-on will help you define messages in different languages.
Include it and then use it as following:
$(form).formValidation({
framework: '...',
icon: {
// ...
},
addOns: {
i18n: {}
},
fields: {
// ...
}
});
For more information, see http://formvalidation.io/addons/i18n/
This is how to solve your problem:
Include the language file es_ES.(min.)js after including formvalidation.(min.)js.
Set the locale:
Option 1: Use the locale option as you provided in your question.
Option 2: You can add the attribute data-fv-locale="es_ES" to your form.
Option 3: Use the setLocale method:
$('#yourFormId').formValidation('setLocale', 'es_ES');
NOTES:
the setLocale method is not documented, to see its usage see
the example here http://formvalidation.io/addons/i18n/.
Option 1 & 2 should be used before you initialize the plugin and without using the i18n add-on.
Option 3 after initialization.

Related Links

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

Categories

HOME
cakephp-3.x
sidekiq
erlang
tinyos
system-verilog
facebook-graph-api
boost-thread
cocos2d-x-3.0
ruby-on-rails-3
heap-memory
wampserver
defragmentation
value
histogrammar
quill
java-home
triggers
lotus-notes
game-maker-studio-1.4
dryioc
x-frame-options
netezza
opera-mini
zope
scenebuilder
derived
ng-show
flat-file
ejbca
sonarqube-msbuild-runner
dspic
go-cd
myob
nmf
python-textprocessing
emv
web-frontend
chrome-native-messaging
system.data.sqlite
winscp
mangodb
forum
sharp
jackson-dataformat-csv
apache-cloudstack
ipfw
oracle-xml-db
transient
rhino
large-data
rhel.net
coreclr
code-behind
topic-modeling
concrete5-5.7
parent
tic-tac-toe
polyfills
flex4.5
datalog
google-account
onmouseover
rdw
ajp
production-environment
drawingarea
dimple.js
livefyre
workflow-foundation-4.5
maintenance
fedora20
react-native-fbsdk
fontconfig
opencpu
jcreator
ingres
bettercms
emgu
gradle-script-kotlin
c64
activeweb
pydio
tomcat5
django-filer
unsatisfiedlinkerror
amf
amazon-kcl
brackets-shell
evo
selendroid
textkit
anti-patterns
webhdfs
twython
es2015
google-earth-plugin
pgagent
microblaze
dto
csplit
lumx
joox
factors
anjuta
winrt-httpclient
bigint
driver-signing
ng-hide
datarepeater
subtract
expression-evaluation
cookieless
dashcode
search-path
getresource
exitstatus
grooveshark
microsoft.ink

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