Cover photo
Kim Gaard


Kim Gaard

Discussion  - 
Is there a way to stop formvalidation from working as soon as the page loads
Phuoc Huu's profile photoKim Gaard's profile photo
Hi Phuoc.

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

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.

Add a comment...

Kim Gaard

Discussion  - 
Hi Phuoc,

I have a scenario on a page, where an Id field is enabled/disabled depending on a variable set by the calling web page.

If the variable var formMode == "Add" then the field UserId, validator is enabled otherwise it is disabled.

Now when I submit the form when the formMode is not "Add", the form validation works correctly and the form is submitted.

However when I have the formMode = "Add", the form validation works correctly also, but the form doesn't submit. In fact the on success event doesn't fire at all.

The validation code is quite long, so can I email the script part to you?

Kim Gaard's profile photo
It wasn't the delay, but the remote php. I was returning either a 1 or a 0, instead of true or false.
Add a comment...
Basic Information