Discussion  - 
 
Is there a way to stop formvalidation from working as soon as the page loads
1
Phuoc Huu's profile photoKim Gaard's profile photo
 
I am not sure that I understand that. Can you please clarify me?
 
Hi Phuoc.

Here is my code for validation of one field within the document ready function of the javascript:

$("#rooms-form")
.formValidation({
framework : 'bootstrap',
/* Show Errors as a tooltip. If you want errors to show below the field
then Delete the err object */
err: {
container: 'tooltip'
},
// Feedback Icons
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},

// List of fields and their validation rules
fields: {
data_RoomName : {
// Trigger 'blur' sets to validate field when lose of focus
trigger: 'blur',
message: 'Room Name is required',
validators: {
notEmpty: {
message: 'Enter the resource room name'
},
stringLength: {
min: 1,
max: 50,
message: 'The resource room name must be between 1 and 50 characters long'
}
}
},

Now as soon as the page loads, the RoomName is evaluated returning an error as seen in the screen shot below:

The field hasn't got focus, neither has it lost focus yet.

Ah maybe that's it, first set autofocus for field then it is fine. Sorry to bother you.

Regards
https://plus.google.com/photos/...
Add a comment...