Input text value is empty on submit

Hi there,

I have a form in a modal which contains 3 fields: type (Select), title (Text input) and Text area. The type field contains 2 values (news, insight) and title field is required only when a specific entry is selected. So I have added a dynamic validation ({{ === 'news' }}) on the text input.

The form works well but there's a small issue that I can't fix. When I select type News in the Select field and try to submit the form, the validation triggers correctly. However, once I enter a value in the text input after the failed validation and submit, the value of {{}} is empty.

Any idea how to fix this issue or it's a bug in Retool?

Thank you.

Hey @kassim-ivs!

Can you try referencing the component directly in the validation field instead of passing through the form data? Something like:

{{ type.value === 'news' }}

It looks as though referencing could be creating a dependency cycle, you might see something like this in your browser console:

Which I'd imagine is the cause of the odd behavior.

Hey @Kabirdas ,

Thank you for you reply.

When I use {{ type.value === 'news' }} as the title's validation, the validation does not trigger when News is chosen.

:thinking: can you try renaming the component to typeInput or so? I'm wondering if the type name is restricted in some way:

@Kabirdas you were right. Renaming the type field fixed the issue.
Thank you for your assistance.