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

No required field identification in admin and inconsistent error messages #15434

Closed
xtomas opened this issue Mar 1, 2024 · 6 comments
Closed
Labels
Milestone

Comments

@xtomas
Copy link
Contributor

xtomas commented Mar 1, 2024

Describe the bug

  • content fields and some parts added to to content type, can be set as required, but there is no visualization before submitting changes
  • validation error messages for required fields has inconsistent text messages (some contains dot at the end, some don't, some are using '' for value some has explicit value name in the text
  • validation error messages are included in validation summary only, and not under the required field, but for example in TitlePart is everything correct

To Reproduce

Steps to reproduce the behavior:

  1. Make some text field, date filed, numeric field, title part, etc. required on some content type
  2. Click on create new item of modified content type
  3. See validation summary and required fields UX behavior

Expected behavior

  • all error messages should be written in the same format and text like for example: Please add value for '{0}', this should be rewritten also in localizations...
  • at least some css class should be added on all required fields label to be able to identify required fields in the content item form
  • required validation messages should be displayed under each validated field

Screenshots

I've created Article content type with required TitlePart, Perex, Image media field and taxonomy fields Consumers and Topics.

On the screenshot bellow you can see variable validation messages, no validation messages under inputs and red border only on some fields (nothing on taxonomy fields)

c2e9c327-77b7-46b3-bdc9-9532c395a7e6

Solution?

I think it's easy to add css required class into edit view for all required-able files using @Orchard.GetLabelCssClasses and PartFieldDefinition.GetSettings with required identification accessible inside view. Addition of validation messages under fields inputs is also possible for most of fields. Only in taxonomy field there is some vue.js component and it does not work for me yet. Red borders can be I think also added. Textation can be also rewritten in same way.
I've tried to use some overrides inside custom theme but I find it difficult to maintain in the future because of new versions, behavior... I think it will be better to have it out of the box.

@xtomas xtomas added the bug 🐛 label Mar 1, 2024
@Skrypt
Copy link
Contributor

Skrypt commented Mar 1, 2024

I think the validation is there for each of these Content Fields but when it throws it highlights only the first element that needs to be fixed while it should display all of the faulty ones.

@xtomas
Copy link
Contributor Author

xtomas commented Mar 1, 2024

I've tested it now and all text fields marked as required are highlighted (currently selected one tab with more required text fields). Note that this is my testing overriden version views version with validation messages under text field inputs and stars after label indicating required field.

Screenshot 2024-03-01 at 17 22 52

@sebastienros
Copy link
Member

Note that this is my testing overriden version views version with validation messages

Is this something you could provide as a PR if you think that won't break any feature.

@sebastienros sebastienros added this to the 1.x milestone Mar 7, 2024
@xtomas
Copy link
Contributor Author

xtomas commented Mar 8, 2024

Note that this is my testing overriden version views version with validation messages

Is this something you could provide as a PR if you think that won't break any feature.

Yes, I will try to prepare PR.

@xtomas
Copy link
Contributor Author

xtomas commented Mar 18, 2024

Note that this is my testing overriden version views version with validation messages

Is this something you could provide as a PR if you think that won't break any feature.

Yes, I will try to prepare PR.

Hello @sebastienros, I've created my local feature branch based on main in my local git clone, but I'm not able to push it into orchard core repository to create pull request.

image

@sebastienros
Copy link
Member

Contributions to oss projects are done in forks

xtomas pushed a commit to xtomas/OrchardCore that referenced this issue Mar 19, 2024
+ add star char for all required fields
+ add validation message for required input field like in TitlePart
* consolidate color for start and validation error messages
* consolidate error message texts
- remove client validation from inputs because of inconsistent form behaviour dependent on used browser, selected locale, ...

OrchardCMS#15434
hishamco added a commit to xtomas/OrchardCore that referenced this issue Mar 22, 2024
@xtomas xtomas closed this as completed May 21, 2024
@MikeAlhayek MikeAlhayek modified the milestones: 2.x, 2.0 Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants