We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid Form Validator unexpected behavior on inputs


I'm encountering some problems when validating inputs in the Grid Edit Dialog Template. I'm using the Form instance of the grid when actionComplete event is triggered:

var formObject; // defined globally
formObject = args.form.ej2_instances[0]; // inside actionComplete function

*For more details see Fig. 1

Using the formObject, some rules are added to the inputs in the dialogTemplate to behave in the way i need. But the problem is that i've set just one rule (required: true) to the input (that is giving the error) 'codigoProduto' and the validator instance is saying me that i have two more rules that is: maxLenght and errorOption.

I know that maxLenght can be set by the maxLenght attribute in the input element and errorOption is a property in the FormValidator instance. But i didn't set those rules in the input with the addRule method. I suppose that this non-valid rules gives the 'match' error (See Fig. 3). I've encountered the '[...] parentElement of undefined' error as well, but i think this one occurs when the input element id it's not the same that was used in the addRule method (correct me if i'm wrong)

This problem can be causing another error (i think): my save button in the edit dialog is not triggering the save command when pressed. It's not sending the save request,

About the dialog template: i've created i dialog template that have two radio buttons, that expose/block some inputs when choosen. I don't know if is there some other way that using the default edit dialog this configurations can be done with  the inputs without the need of set the validation properties on the column declarations... if this can be done, please let me know. (See Fig 4, Fig 5 and File 1)

Two more questions:
  1. Can the error message be removed when the radio button is changed? (Fig. 6)
  2. Can Form Validator Object be created inside the actionComplete event using the ej2.inputs.FormValidator or its better to use the ej2_instances[0] to acess the validator? It's a bad pratice doing so?
PS: i've added the .js file and part of the HTML elements in the zip file, with the images as well.

Please, let me know if i missed something.



Attachment: Syncfusion_Thread_da2f0e6.zip

Live Chat Icon For mobile
Up arrow icon