Douglas Gaskell
Douglas Gaskell

Reputation: 10030

Semantic UI remove/modify form validation fields

I'm trying to remove or modify form validation after it has been set (In the case of a dynamic form where inputs may get added or removed dynamically.). I cannot figure out how to do this.

Adding in new fields does just that, adds new fields. It doesn't seem to override existing form validation fields.

How can I remove, or change form validation fields in Semantic UI?

Upvotes: 4

Views: 2790

Answers (1)

Dzmitry
Dzmitry

Reputation: 466

Just re-initialize a form after adding a new element. Look at this topic I mean do - $('.ui.form').form({fields: validationRules}) after adding a new element. Also you can add new rules in this moment just:

var newValidationRules = $.extend(validationRules, additionalValidationRules);
$('.ui.form').form({fields: newValidationRules})

You can reset form Validation rules by this: $('.ui.form').form('destroy')

Upvotes: 2

Related Questions