Skip to content

Fix/menu option validation errors - #90

Open
diverds1992 wants to merge 2 commits into
tastyigniter:4.xfrom
diverds1992:fix/menu-option-validation-errors
Open

Fix/menu option validation errors#90
diverds1992 wants to merge 2 commits into
tastyigniter:4.xfrom
diverds1992:fix/menu-option-validation-errors

Conversation

@diverds1992

Copy link
Copy Markdown

Summary

This PR improves validation feedback for menu item options in the Orange cart item modal.

Currently, when multiple menu options are invalid or required but not selected, only the first validation error is shown. The customer then has to fix that option and submit again before the next validation error becomes visible.

This PR validates all menu options first and shows all validation errors at once, directly below the relevant menu option.

Current behaviour

Given a menu item with multiple required options, for example:

  • Basis
  • Sauce
  • Cutlery

If none of them are selected, only the first validation error is displayed.

After selecting that option and submitting again, the next validation error is shown.

This results in multiple submit attempts for menu items with several required or otherwise invalid options.

In addition, validation messages containing HTML formatting such as <b> or <strong> can be displayed literally because the Livewire error component escapes the validation message.

New behaviour

All menu options are validated before the cart item is saved.

Validation errors are collected per menu option and added to Livewire using keys in the following format:

menuOptions.{menu_option_id}

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.

1 participant