Hi,
i’m coding in angular and i using Smart.Form, creating the form controls and validations from .ts files. To add the entity values into form values. I’m doing the form = new Smart.form(…) when the data in the entity object is loaded. In the same view, if i load another entity, i recreate the form reasigning the value to the form again, but instead of removing the old form controls and reasign the new ones, the form controls and validators are nesting them.
How should i do this ?
Thanks, i attach an example of the code
When entity is loaded i do this:
ngOnchange(): void {
const entity ....
this.createForms();
this.dataForm.value = entity;
}
createForms(): void {
this.dataForm= new Smart.Form('#dataForm', {
codivas: ['', {
validationRules: [
{ type: 'required', message: 'El código es obligatorio.' },
]
}]
........
})
}