Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Channel form inline errors {field_errors} tag pair #4849

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

Open
robinsowell opened this issue May 16, 2025 · 4 comments · May be fixed by #4860
Open

Channel form inline errors {field_errors} tag pair #4849

robinsowell opened this issue May 16, 2025 · 4 comments · May be fixed by #4860
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.

Comments

@robinsowell
Copy link
Contributor

robinsowell commented May 16, 2025

The {field_errors} tag pair just outputs the error - no label or any indication of what the error is in relationship to. It also looks like it shows double the errors.

So if you have 2 missing required fields you get:

This field is required.
This field is required.
This field is required.
This field is required.

I see where that happens- there's one error for field_id_x key and one for the actual label- in the channel_form_lib.php around 1602.

We need to either give them a {label} variable or include the label in the {error} like it's done in the message when not using inline errors. And also not double it up.

@robinsowell robinsowell added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label May 16, 2025
@TomJaeger
Copy link
Contributor

TomJaeger commented May 21, 2025

Just for clarification... this is the result when using the {fieldl_errors} tag pair... we need to add some additional variables to this

https://docs.expressionengine.com/latest/channels/channel-form/examples.html#entry-form-using-the-field-tag-and-inline-errors

@TomJaeger
Copy link
Contributor

Gut is that we should have field_label, field_name etc. available here... so we give details on issues at top of form when desired etc.

@intoeetive
Copy link
Contributor

2 things here:

  1. the example in the docs is wrong, it should be {field}: {error} not just {error}
  2. the errors should not be duplicated of course

I'll submit PRs for both

@robinsowell
Copy link
Contributor Author

robinsowell commented May 21, 2025

Oh man- yes, {field} works. It does still sort of duplicate- I get:

title: This field is required.
url_title: This field is required.
field_id_10: This field is required.
field_id_11: This field is required.
seo_title: This field is required.
seo_desc: This field is required.

So just needs a doc fix and clean up the duplicates and maybe add more variables. So {label} I would definitely want, {field} would be the custom field short name (seo_title for example above), and then field_id_x might be useful to have, but I can't think of what to call it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.
Projects
None yet
3 participants