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

WIP: Use anonymous blade component for errors #15421

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

snipe
Copy link
Owner

@snipe snipe commented Aug 29, 2024

Still lots more to be done here, and a ton of testing to do

Copy link

what-the-diff bot commented Aug 29, 2024

PR Summary

  • New Error Display Component
    A blade component for displaying form errors has been added to the codebase. This will help improve the user experience for forms by clearly stating any errors made during form fill-ups.

  • JavaScript Validation Changes
    Updates to JavaScript validation code have been made to handle form validation. Users will now receive immediate feedback about valid/invalid entries on submission of forms.

  • Enhanced Error Reporting Across Multiple Forms
    A new component x-form-error has been integrated across multiple form fields to improve error handling and display. The forms that have received this enhancement include, but are not limited to:

    • Accessory select, Address, and Asset select
    • Category and Company select
    • Consumables and Date picker
    • Department select and Depreciation select
    • Email and End-of-life date fields
    • Fax and Image upload
    • Item number and Kit select
    • License and Location profile select
    • Maintenance type and Manufacturer select
    • Minimum quantity and Model select
    • Name, notes, order number
    • Phone, purchase cost, purchase date
    • Quantity, serial, status (select and general)
    • Supplier (select and general)
    • Logo upload, user select, and warranty

In short, these changes focus primarily on improving the user feedback system, ensuring form validation is correctly handled, and improving the overall user experience.

@@ -0,0 +1,6 @@
@props(['name'])
@error($name)
<span class="alert-msg">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Off the top of my head, I think it'll be a good idea to add {{ $attributes }} to this line via {{ $attributes->merge(['class' => 'alert-msg']) }} so stuff passed in is automatically rendered on the component. So something like <x-form-error name="something" class="an-extra-class-here-to-add-with-alert-msg" id="some-id-to-hook-on-to" /> would work.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I don't think we need that though, since these are specifically for inline form errors which always have the same class.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's fair but it's not only classes we could pass if we added that line. I don't think we're doing it now but we could pass in an id if we needed to target it with some javascript or something in the future. Not necessary but I usually tend to add {{ $attributes }} to components by default out of habit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants