If we have 2 fields and want to alternatively make them required and visible, based on the selection from a dropdown, the Required validation does not work as expected and the Submit button stays disabled.
It seems that once a field was marked as Required and it gets programmatically hidden, the Required mark does not get removed programmatically as it should (it ignores the JS condition).
See the screen recording and sample app for more details.
Front thread
Steps To Reproduce
Use a JSON Form having one select "Type" (options Red and Blue) and two Input widgets labeled "Red" and "Blue".
If the value of "Type" is "Red", then the "Red" field should be visible and required; also the "Blue" field should be non-required and hidden.
If the value of "Type" is "Blue", then the "Blue" field should be visible and required; also the "Red" field should be non-required and hidden.
For the Red Field in the required js put {{formData.Type == "Red"}} and visibility js put {{formData.Type == "Red"}}
For the Blue Field in the required js put {{formData.Type == "Blue"}} and visibility js put {{formData.Type == "Blue"}}
Now if the Type is selected as "Red", only the Red field should be visible and required, but this is not happening if we switch between red and blue in the type, it also considers both fields required validation.
Is there an existing issue for this?
Description
If we have 2 fields and want to alternatively make them required and visible, based on the selection from a dropdown, the Required validation does not work as expected and the Submit button stays disabled. It seems that once a field was marked as Required and it gets programmatically hidden, the Required mark does not get removed programmatically as it should (it ignores the JS condition). See the screen recording and sample app for more details. Front thread
Steps To Reproduce
{{formData.Type == "Red"}}
and visibility js put{{formData.Type == "Red"}}
{{formData.Type == "Blue"}}
and visibility js put{{formData.Type == "Blue"}}
Public Sample App
https://app.appsmith.com/app/jsonform-validation-required/page1-65280f6880b32971dff37e3c
Environment
Production
Issue video log
https://www.loom.com/share/50c7b4b6562544dfa598216aa82094fc
Version
Cloud v1.9.40