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) O3-2867: Add required validation to the conditions form's condition field #1665

Merged
merged 15 commits into from
Mar 5, 2024
Merged

(fix) O3-2867: Add required validation to the conditions form's condition field #1665

merged 15 commits into from
Mar 5, 2024

Conversation

Twiineenock
Copy link
Contributor

@Twiineenock Twiineenock commented Feb 14, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Currently, when a user try to submit the conditions form without selecting a condition no form validation is displayed. Something like 'Please choose a condition' can be shown to the user.

Screenshots

before
before

after fix
after

Related Issue

https://openmrs.atlassian.net/browse/O3-2867

Other

attachments to issue
ConditionForm.webm

@ojwanganto
Copy link

I think we should just indicate that a condition is required to save the form. The error title is somehow misleading since at this point we haven't hit the backend.

@Twiineenock
Copy link
Contributor Author

Thanks Antony, let me work on it in that line and would wait for your view about the changes

@hadijahkyampeire
Copy link
Contributor

@Twiineenock these are so many files changed, try to rebase well.

@Twiineenock
Copy link
Contributor Author

@hadijahkyampeire I repeated the rebasing I think I think they yarn file changed because of this command yarn up openmrs@next @openmrs/esm-framework@next then the translations changed because my changes of the error message in the conditions-form.component.tsx

@hadijahkyampeire
Copy link
Contributor

@Twiineenock Yes the yarn lock changes after running yarn up, please always revert the changes after.

@denniskigen
Copy link
Member

denniskigen commented Mar 5, 2024

State of things following the commit I pushed:

conditions-validation.mp4

These changes:

  • Ensure that the submit button is not disabled if mandatory fields are not filled
  • Appends an asterisk to labels of mandatory fields to mark them as such

They are informed by this discussion on the ux-design-advisory channel.

@denniskigen denniskigen changed the title (fix) O3-2867 Add validation on the conditions form (fix) O3-2867: Add required validation to the conditions form's condition field Mar 5, 2024
@denniskigen
Copy link
Member

A subsequent fix to this should mark the clinical status field as mandatory. This is to get in line with what the contract the backend provides https://hl7.org/fhir/condition.html#tx.

Copy link
Member

@denniskigen denniskigen left a comment

Choose a reason for hiding this comment

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

Thanks, @Twiineenock!

@denniskigen denniskigen dismissed vasharma05’s stale review March 5, 2024 22:09

Changes implemented in subsequent commits

@denniskigen denniskigen merged commit 7982204 into openmrs:main Mar 5, 2024
6 checks passed
usamaidrsk pushed a commit to usamaidrsk/openmrs-esm-patient-chart that referenced this pull request Mar 11, 2024
…tion field (openmrs#1665)

* validate conditions form

* validate conditions form

* validate conditions form

* validate conditions form

* validation

* validation

* updated core libraries

* (fix) Add validation on the conditions form

* validation

* fix tests

* update libraries

* fix tests

* Final tweaks

- Don't disable submit button if mandatory fields are not filled
- Append an asterisk to labels of mandatory fields to mark them as such

* Fix E2E test

* More fixes - only validate existence of a condition when creating

---------

Co-authored-by: Dennis Kigen <[email protected]>
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.

5 participants