Problem/Motivation

If you are on a node that has a paragraphs option, when you click the button to add a pargraph instance, it triggers the validation to run and shows warnings just above the paragraph.

We will need to detect that the event is somehow an initial add, and prevent validation from running.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

swirt created an issue. See original summary.

swirt’s picture

I have not determined a way to intercept this yet.

swirt’s picture

I discovered this is not specific to Paragaphs. Even adding an image to an image field triggers validation on the whole node.

swirt’s picture

This was caused by ajax requests triggering the validation of the entire entity. I have hopped around this by detecting the ajax type of call and bypassing the validation in that case.

Other solutions would solve this by setting '#limit_validation_errors' on the form, but in the case of field constraints and validation, we don't have access to the form or form_state.

swirt’s picture

swirt’s picture

The MR solves the issue of premature firing of validation on ajax changes to the entity form.

  • swirt committed c737c0d8 on 1.0.x
    #3541613 Adding an entity reference validate the entire node
    
swirt’s picture

Status: Active » Fixed
swirt’s picture

Status: Fixed » Closed (fixed)

Released with 1.0.0-beta3

swirt credited dafeder.

swirt’s picture

Crediting dafeder for kicking this around with me enough to lead me to a solution.