Hello Team,

I am facing an issue when we hide the node title being hidden from form, and save. Drupal throws error.

Steps to reproduce

  1. Go to "admin/structure/types/manage/article/form-display"
  2. Move "title" to disabled OR Select hidden from title widget settings
  3. Go to "node/add/article"
  4. Try to create a node, and you will land on an error screen.

Attaching screenshots.
Happy to help and provide any further info.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vaibhavjain created an issue. See original summary.

cilefen’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs issue summary update

Please share the error. It is best put in the issue summary in full, and perhaps the essential part in the title. For example:

"Hiding title from Form Display throws FooBarException when adding a node"

navneet0693’s picture

Title: Hiding title from Form Display throws error » Hiding title from Form Display throws Drupal\Core\Database\IntegrityConstraintViolationException
Version: 8.2.0-rc1 » 8.2.4
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active
FileSize
145.19 KB
145.92 KB

I am able to reproduce the issue. Updated summary.

navneet0693’s picture

Title: Hiding title from Form Display throws Drupal\Core\Database\IntegrityConstraintViolationException » Hiding title from Form Display in content type throws Drupal\Core\Database\IntegrityConstraintViolationException
navneet0693’s picture

scott_euser’s picture

In this case I think we need to add validation to the 'Manage form display' screen.

Reasoning:
Title is a required field and cannot be made not required as the node table in the database also requires it.

Proposal:
Add an additional validation to 'Manage form display' to throw an error when the title field is not enabled.

I was unable to switch the title field to use a hidden widget: perhaps not allowed in 8.4.x-dev or perhaps a contrib module is being used that offers that option?

scott_euser’s picture

Status: Active » Needs review
FileSize
1.18 KB

I think this should be specific to node like the attached patch as other entities may not have the title as a required column in the database.

Status: Needs review » Needs work

The last submitted patch, 7: hiding_title_from_form-2801283-7.patch, failed testing.

scott_euser’s picture

Status: Needs work » Needs review

Hmmm patch says pass, changing back to needs review.

cilefen’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2821507: Handle exceptions gracefully when saving node forms

I am marking this a duplicate of an issue with more comments. Please continue there.