jqueryvalidationformvalidation-plugin

How to disable validation when entering a value for jQuery plugin - formvalidation?


I am using FormValidation, a jQuery plugin to validate my form.

If I have a validation set up like this:

$form.formValidation({
    framework: 'bootstrap',
    excluded: ':disabled',
    message: 'This value is not valid',
    row: {
      selector: 'div'
    },
    fields: {
      'name': {
        validators: {
          notEmpty: {
            message: 'Please enter your name'
          }
        }
      }
}

On every input into my input field name, the validation triggers. I would want for the validation to trigger only when I click on submit button (which I have already done in my code), but I am failing to disable the validation when entering a value into a input field.

How can I do that? What settings above I need to change or add?


Solution

  • The answer is to add a live property and set it as disabled like this:

    $form.formValidation({
        framework: 'bootstrap',
        excluded: ':disabled',
        live: 'disabled',
        message: 'This value is not valid',
        row: {
          selector: 'div'
        },
        fields: {
          'name': {
            validators: {
              notEmpty: {
                message: 'Please enter your name'
              }
            }
          }
    }
    

    Settings: Form live

    I have created an answer. Thanks @CBroe