Karthik Tv
Karthik Tv

Reputation: 35

1000hz bootstrap-validator resetForm Validation results

I'm using this v-0.9.0 version of Validator.js,

I used below code,

$('#frmNew')[0].reset()
$('#frmNew').validator('destroy').validator()

When i use resetForm, Validation symbols and colors[Red & Green] are still exist in screen. enter image description here

Upvotes: 0

Views: 1951

Answers (1)

Shehary
Shehary

Reputation: 9992

It's a known issue in 1000hz bootstrap-validator with no proper fix yet, can check this issue Destroy method doesnt remove icons on github

Possible solution is add following piece of code when reset or destroy the form and remove error and success classes.

this.$element.find('.has-error').removeClass('has-error')

var $feedback = this.$element.find('.form-control-feedback')
$feedback.removeClass('glyphicon-warning-sign').removeClass('glyphicon-remove')

this.$element.find('.has-success').removeClass('has-success')

var $feedback = this.$element.find('.form-control-feedback')
$feedback.removeClass('glyphicon-warning-sign').removeClass('glyphicon-ok')

Suggestion

Use this BootstrapValidator validation plugin, it gives more control to validate form fields, designed to use with Bootstrap 3 and will not face these types of issues & bugs.

Upvotes: 1

Related Questions