Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clear button on create form should reset select field #939

Merged
merged 2 commits into from
Mar 9, 2023

Conversation

scottyoung
Copy link
Contributor

@scottyoung scottyoung commented Mar 8, 2023

Problem

The Clear button on a Create Form does not reset a SelectField correctly.

Solution

Setting the value of a SelectField to an empty string "" rather than undefined will correctly set the value of the field to the first option of the dropdown, either the Placeholder, or the first option if no placeholder exists.

Additional Notes

Links

Ticket

GitHub issue _____

Other links

Verification

Manual tests

  1. Load a Create form with a SelectField. Choose an option for the SelectField, and then press the Clear button. SelectField returns to placeholder text.
  2. Load an Update form with a SelectField. Choose a new option for the SelectField, and then press the Reset button. SelectField returns to original option.

Automated tests

  • Unit tests added/updated
  • E2E tests added/updated
  • N/A - (provide a reason)
  • deferred - (provide GitHub issue for tracking)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@scottyoung scottyoung requested a review from a team as a code owner March 8, 2023 17:52
@Jshhhh Jshhhh merged commit 326b579 into main Mar 9, 2023
@Jshhhh Jshhhh deleted the fix/select-field-clear branch March 9, 2023 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants