How to validate child dynamic form fields?

In App.tsx I have defined the <form>, FormValidator and defined the rules.

How can I use it to validate form fields in a child component that dynamically adds fields later? I have tried, but validation doesn't work


6 Replies

PM Ponmani Murugaiyan Syncfusion Team June 29, 2021 03:45 PM UTC

Hi Nick, 

Thanks for contacting Syncfusion support. 

Currently we are checking the reporting query. We will update further details in 2 business days (July 01, 2021). We appreciate your patience until then. 

Regards, 
Ponmani M 



PM Ponmani Murugaiyan Syncfusion Team July 2, 2021 02:41 AM UTC

Hi Nick, 

Sorry for the inconvenience caused. 

We are facing complexity in our end, so we need additional time to validate this query. We update further details in 2 business days (July 6, 2021). We appreciate your patience until then. 

Regards, 
Ponmani M 



NL Nick Lechnowskyj July 2, 2021 02:46 AM UTC

Thank you for the update.



PM Ponmani Murugaiyan Syncfusion Team July 6, 2021 02:45 PM UTC

Hi Nick, 

Thanks for your valuable patience. 

We have prepared sample as per your requirement to add validation for dynamically added component. You can validate the dynamic field using the validate method from formObject instance as like below code snippet with respect to blur/change/input event of the corresponding component. 

  1. Click on the button to render dynamic component TextBox.
  2. Now submit the form, the validation takes place as expected.

{this.state.show ? ( 
    <div className="form-group"> 
      <TextBoxComponent id="Email" name="email" placeholder="Email" blur={(this.onBlur = this.onBlur.bind(this))} /> 
    </div> 
  ) : null} 
 

onBlur() { 
    this.formObject.validate('email'); 
  } 
 


Please get back us if you need further assistance. 

Regards, 
Ponmani M 



SA Sabyasachi December 14, 2021 11:13 AM UTC

Thanks a lot. I had the same issue. THis worked like a charm!!

Thanks a lot. I had the same issue. THis worked like a charm!!




BC Berly Christopher Syncfusion Team December 15, 2021 06:03 PM UTC

Hi Sabyasachi, 
  
Most welcome. Please let us know if you need further assistance on this. 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon