Form validation error

Hello, I have a form in the modal to edit product data. There is one field as required. Submitting form without filling that value will give me error, that this field is required but when I close that modal and reopen it for another product, that error remains there although value is there. Is there any way to reset form validations on modal close?
Screenshot (98)
Screenshot (99)

Thank you

Hello, I found a solution for this using productName.clearValidationState() in JavaScript query and triggering it at modal close time.
Thanks.

1 Like

Hello, anyone can help me, how to clear validation state for a date picker using javascript?
Thanks!

Hi Vinkal! It doesn't look like the date time picker component has any functions available to clear the validation state. Is there a reason you have it required in your form?

component options
All components show their available options in the autocomplete menu after "." :slight_smile:

Hi @victoria ,
I have a form in a modal where I have used datetime picker as a required field. So when I am submitting the form without date, it's indicating the error as required field, this is correct. But after closing modal, re-opening that modal, that error still remains there. So I need to clear that validation for datetime picker when I close a modal.

image
Thank you!

It looks like we don't currently have any way to clear the validation state of a datetime picker, but I will file this as a bug report internally! I'll tag this thread to reach out to with any updates.

1 Like

@victoria
Okay, Thank you!

@victoria - I'm trying to use the clearValidationState() on a text input field and it doesn't appear to exist. Has this function been removed?

Solved. Looks like it's been renamed to clearValidation() instead of clearValidationState().

Is this function documented anywhere?
The docs found here Retool | Component Reference don't mention any of the functions available on the text component.

Hi @Col! Awesome, glad you found it. It doesn't like it's documented anywhere. In general, the best way to see what kind of functions are available on a component would be to look through the autocomplete menu for an "Function"s. There's usually a small blurb over those functions that explain how to use them!