Skip to content

Form was becomes invalid, When dynamically adding and removing required fields  #6171

@venkatesh-elchuri

Description

@venkatesh-elchuri

Expected Behavior

CPT2206091235-511x451

When the checkbox is unselected, a new required TextInput field appears added. Then form was invalid as expected. (As no value entered for new filed).
But when I toggled back the checkbox , the TextInput was removed from , But still the i was getting form was invalid from onValidate method , This is the issue.

I saw the similar issue was closed #4743 but still am able to reproduce.

Actual Behavior

When I dynamically removing the field , Then form status should be Valid only if all other validation are fine.

URL, screen shot, or Codepen exhibiting the issue

https://codesandbox.io/s/form-dynamic-fileds-e57mf5?file=/src/App.js

Steps to Reproduce

  1. See the code sand box and recorded GIF.
  2. conditionally show and hide an required field inside a form , check the expected form validation status

Your Environment

  • Grommet version: Latest
  • Browser Name and version: Chrome latest
  • Operating System and version (desktop or mobile): Window & linux

Metadata

Metadata

Assignees

Labels

bugissue that does not match design or documentation and requires code changes to address

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions