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

Error messages copied from first add-another item #343

Open
1 task done
taomoh opened this issue Apr 7, 2022 · 0 comments
Open
1 task done

Error messages copied from first add-another item #343

taomoh opened this issue Apr 7, 2022 · 0 comments

Comments

@taomoh
Copy link

taomoh commented Apr 7, 2022

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem
    • Followed all applicable steps in the debugging guide
    • Checked the FAQs on the message board for common solutions
    • Checked that your issue doesn't exist: https://github.com/ministryofjustice/moj-frontend/issues
    • Checked that there is not already a package that provides the described functionality

Description

The mechanism used by MoJ "add-another" component to copy items includes error messages in the copy.

Steps to Reproduce

  1. Populate first "add-another" item and validate in a way that displays an error message:
    Error in first item

  2. Press the Add button, to add a new item

Expected behaviour:
The newly added item should not have any error messages

Actual behaviour: [What happens]
The error message from the first item is replicated in the newly added item:
Error copied in added item

Reproduces how often: [What percentage of the time does it reproduce?]
100%

Versions

@ministryofjustice/frontend: 1.3.0
OS: Ubuntu 20.04.4 LTS
Browser: Chrome 100.0.4896.60 (Official Build) (64-bit)

Additional Information

N/A

taomoh pushed a commit to hmcts/civil-citizen-ui that referenced this issue Apr 11, 2022
… copied to make MoJ frontend library work
jneelakandan pushed a commit to hmcts/civil-citizen-ui that referenced this issue Apr 26, 2022
* Court Orders: initial commit

* Make MoJ library work

* Show 'Enter at least one court order' error

* First working version of array data binding with 'Add another' MoJ component

* Match as-is OCMC alignment

* Address case when model data is empty

* Remove submitted empty court orders

* Override CSS to not show Remove button in 'Add another' MoJ component instances in Citizen UI

* Format code

* Get enhancements to genericForm.ts from branch CIV-1478_expenses

* Manage validation errors for nested array of court orders

* Get enhancements to genericForm.ts from branch CIV-1478_expenses

* Make constant name more accurate

* Workaround for ministryofjustice/moj-frontend#343 and ignore js files copied to make MoJ frontend library work

* Remove duplicate code

* Extract macro into separate file

* Add client logic to stop showing "Add another court order" button once the maximum number of rows (10) has been reached

* Align input text area width while keeping it flexible

* Remove unused imports

* Remove duplicate constant

* Add test coverage and remove duplicate error message constant

* Improve logic to locate add-another buttons to add event listener

* Exclude client js code from sonar scan

* Exclude MoJ boilerplate code from linting

* Remove lint warnings

* Workaround 0 input being cleared upon form submission

* PR review feedback

* PR review feedback

* PR review feedback

* Attempt to fix pipeline issue

* PR review feedback

* PR review feedback

* PR review feedback

* Add guard against undefined object scenario

* Undefined amount should cause the "one pound or more" error message
Undefined instalment amount should cause the "higher than 0" error message

* Workaround so that 0 input doesn't get cleared upon validation (behaviour inherited from govukInput component)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant