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

Can't work with multiple istances of FormValidator

I am trying to validate a form inside a Dialog,
problem is: when I close the Dialog and try to reopen it, the validation does not trigger and the submission becomes impossible.

I think the issue is caused by the fact that I only hide the Dialog, and consequently the FormValidation component.

Greeting
Matteo

Attachment: AssemblyAttachSequenceDialog_10477abe.7z

7 Replies

VK Vinoth Kumar Sundara Moorthy Syncfusion Team July 2, 2019 01:45 PM UTC

Hi Matteo, 
 
Good day to you. 
 
We have prepared a sample based on your provided code snippet and we are not able to reproduce the reported issue. Form validation is working properly at every time when the Dialog is opened. 
 
 
In above sample, we have re-opened the Dialog after closing the Dialog  when click the button. 
 
We would like to know the below information to reproduce your issue, 
 
1.       Share more details to replicate your issue. If possible replicate your issue in above sample and update us. 
 
2.       Mention how you are closing and reopening dialog. 
 
3.       Provide more details about form submission issue. 
 
Could you please check the above sample and get back to us with the above requested information? Based on that we will check and provide you a better solution quickly. 
 
Regards, 
Vinoth Kumar S 



MA Matteo July 3, 2019 01:47 PM UTC

I managed to reproduce something more similar to my case here: https://stackblitz.com/edit/react-qhmawe-odqd16

Problem is, it works correctly...

2. The opening and closing is managed as per example

3. It looks like the new formValidator remembers the errors from previous instances, the fields previously validated as VALID, show error if not valid in a new instance, but the fields that were previously invalid do not show errors in subsequent dialogs.

To submit I use a button with onclick a function similar to this:
if(formvalidator.validate()){ sendFormData()}


PO Prince Oliver Syncfusion Team July 5, 2019 03:05 AM UTC

Hi Matteo,  
  
Good day to you. 

We have checked your last update. We suspect that, you have solved the validation errors with values after close and open the Dialog component using componentDidMount and setState at your end. 
  
If your issue is not solved in your end, please share the below information, 
  • Please share the video for better understanding your issue.
  • Did you attached the solved sample in last update?

The above information will help us provide a solution. 

Regards, 
Prince 



MA Matteo replied to Vinoth Kumar Sundara Moorthy July 5, 2019 12:17 PM UTC

Hi Matteo, 
 
Good day to you. 
 
We have prepared a sample based on your provided code snippet and we are not able to reproduce the reported issue. Form validation is working properly at every time when the Dialog is opened. 
 
 
In above sample, we have re-opened the Dialog after closing the Dialog  when click the button. 
 
We would like to know the below information to reproduce your issue, 
 
1.       Share more details to replicate your issue. If possible replicate your issue in above sample and update us. 
 
2.       Mention how you are closing and reopening dialog. 
 
3.       Provide more details about form submission issue. 
 
Could you please check the above sample and get back to us with the above requested information? Based on that we will check and provide you a better solution quickly. 
 
Regards, 
Vinoth Kumar S 


I don't understand what are you saying.

Each time I open a new dialog it's a different component, with a state of its own.

The only difference between your example and my code are some dependencies.

I am currently using this versions:

    "@syncfusion/ej2-layouts": "^16.4.55",
    "@syncfusion/ej2-react-buttons": "^16.4.55",
    "@syncfusion/ej2-react-dropdowns": "^16.4.55",
    "@syncfusion/ej2-react-grids": "^16.4.55",
    "@syncfusion/ej2-react-inputs": "^16.4.55",
    "@syncfusion/ej2-react-navigations": "^16.4.54",
    "@syncfusion/ej2-react-pivotview": "^16.4.53",
    "@syncfusion/ej2-react-popups": "^16.4.54",

npm update doesn't seem to update the dependencies.


PO Prince Oliver Syncfusion Team July 8, 2019 12:06 PM UTC

Hi Matteo,   
   
Good day to you. 

To update the npm packages in your end, kindly refer to the following documentation link: https://ej2.syncfusion.com/react/documentation/common/how-to/update-npm-package/ 

Once the packages are updated, If you still face any issues. Kindly share the exact details on the issue with screenshots or video demonstrating the issue in your end. This will help us provide a solution. 

Regards, 
Prince 



MA Matteo July 8, 2019 02:19 PM UTC

Updating the dependencies did in fact work,
but I couldn't do it with the provided link.

I removed each single syncfusion dependency from syncfusion present in package.json, then reinstalled via npm to get the last version.

    "@syncfusion/ej2-layouts": "^17.1.51",
    "@syncfusion/ej2-react-buttons": "^17.1.50",
    "@syncfusion/ej2-react-dropdowns": "^17.1.49",
    "@syncfusion/ej2-react-grids": "^17.1.51",
    "@syncfusion/ej2-react-inputs": "^17.1.50",
    "@syncfusion/ej2-react-navigations": "^17.1.49",
    "@syncfusion/ej2-react-popups": "^17.1.50",




PO Prince Oliver Syncfusion Team July 9, 2019 04:34 AM UTC

Hi Matteo,    

Thank you for your update. We are glad that the issue is resolved in your end. Let us know if you need any further assistance on this. 

Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon