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: make custom field validations consistent between angular and react #5373

Merged
merged 3 commits into from
Nov 11, 2022

Conversation

justynoh
Copy link
Contributor

@justynoh justynoh commented Nov 10, 2022

Problem

Some field validation are inconsistent between angular and react.

Closes #5372

Solution

In angular, we always trim text fields before validation and submission, so this PR implements this for react.

Additionally, I snuck in a quick change to the Input component which had a small bug before. Sorry!

Breaking Changes

  • No - this PR is backwards compatible

Tests

  • Create a short/long text field with some custom length validation. Then, fill the form field with some leading/trailing spaces. The character count should not count the leading/trailing spaces.
  • Submit the form with the text field containing leading/trailing spaces, and look at the sent payload from the Network panel. The sent answer should be trimmed, and contain the correct number of characters that the custom validation requested for.

@justynoh justynoh requested a review from wanlingt November 11, 2022 01:37
@justynoh
Copy link
Contributor Author

Separately, should we implement backend validation for the custom validations set by admins? I don't see it anywhere, unless I'm blind...

@justynoh justynoh marked this pull request as ready for review November 11, 2022 01:48
Copy link
Contributor

@timotheeg timotheeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@justynoh justynoh merged commit 0b1cc67 into develop Nov 11, 2022
@justynoh justynoh deleted the fix/length-validation branch November 11, 2022 02:56
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.

Make field validation behavior consistent between angular and react
2 participants