C.HA
C.HA

Reputation: 298

Bootstrap form validation not working without console error

This is Simple form.

This is JS code:

$(document).ready(function() {
  $('#ledgerHolderjHolderFormEdit').bootstrapValidator({
    feedbackIcons: {
      valid: 'glyphicon glyphicon-ok',
      invalid: 'glyphicon glyphicon-remove',
      validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
      JH_INIT: {
        validators: {
          notEmpty: {
            message: "'First Name' is required."
          },
          regexp: {
            regexp: /^07[a-zA-Z0-9.,:;!-@#\$%\^\&*\)\(+=_-`~><|].+$/,
            message: "'Mobile Number' must only start with '07'."
          },
          stringLength: {
            min: 5,
            max: 30,
            message: "'First Name' must be more than 2 and less than 255 characters long."
          }
        }
      }
    }
  });
});

There are no errors show in console, and could not find errors. Can anyone help me?

Upvotes: 7

Views: 256

Answers (2)

waqas
waqas

Reputation: 29

Make sure you've included JQuery correctly

Upvotes: 2

C.HA
C.HA

Reputation: 298

Solution Found

There are no effect in form and js. Issue was, I wrote html form in 'edit function'(append html form using jQuery). And after validation function wrote in another function. That is the reason.

After many efforts, I wrote validation inside that 'edit function'. The issue was solved.

Upvotes: 8

Related Questions