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

[4.x]: Hidden title field in a section still shows up after validation #13876

Closed
sander-lameco opened this issue Oct 25, 2023 · 6 comments
Closed

Comments

@sander-lameco
Copy link

sander-lameco commented Oct 25, 2023

What happened?

Description

Hidden title field in a section still shows up after validation

Steps to reproduce

  1. Create a section
  2. Set Show the Title field to false
  3. Create a new entry in that section and try to save the entry

Expected behavior

The Title field should remain hidden and not be editable when set to Show the Title field, but is visible and editable after trying to safe the entry. I know it is a required field, but why make it possible to hide it if it is always required? Maybe it should be auto-filled by another field or anything?

Actual behavior

The Title field becomes visible and is editable.

Craft CMS version

4.5.9

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

@sander-lameco sander-lameco changed the title [4.x]: A hidden title field in a section still shows up after validation [4.x]: Hidden title field in a section still shows up after validation Oct 25, 2023
@brandonkelly
Copy link
Member

It’s intentionally shown when there’s a validation error so the error can be shown somewhere, which can happen if the Title Format setting doesn’t produce a value.

However as of Craft 4.5 it’s not really needed anymore, since the Title validation error will also be shown within the validation summary at the top of the page. So I’ve just removed the code that forced the Title field to be shown for validation errors.

@sander-lameco
Copy link
Author

sander-lameco commented Oct 26, 2023

Thanks for looking into this.

Yes I noticed it showing up in the validation summary as well.

As for the Title Format we currently use { title is not empty ? title : commonTitle }, but since we create and update entries using Feed Me we just wanted to try and hide the title field instead of disabling it for the client.

@sander-lameco
Copy link
Author

Another option/feature would be to make a field readonly using conditions.
Couldn't find any issue related to this, should I create a separate issue for this?

@brandonkelly
Copy link
Member

As for the Title Format we currently use { title is not empty ? title : commonTitle }

So most likely you have an entry that didn’t already have a title, and commonTitle was also blank.

Another option/feature would be to make a field readonly using conditions.

Not sure how that would solve anything here? But you’re welcome to suggest it in a new discussion.

@sander-lameco
Copy link
Author

So most likely you have an entry that didn’t already have a title, and commonTitle was also blank.

Honestly I updated and tested the Title Format after you posted the fix. So we had the Title Format set to { title } before when the validation error occured.

Not sure how that would solve anything here? But you’re welcome to suggest it in a new discussion.

Well in this case because the title is filled through FeedMe, and used as an identifier since entries can only be matched by Title in Feed Me. We can still show the field so the client can (re)view the identifier without modifying it directly. Of course they can still modify it in the data provided to FeedMe.

@brandonkelly
Copy link
Member

Craft 4.5.10 is out now, with that change to no longer show the Title field when it has a validation error.

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

No branches or pull requests

2 participants