Incompatibility with embedded form via #ajax

Step to reproduce (without coding..)
- Create a custom content type 'table', with a tablefield field.
- download and install the module http://drupal.org/project/inline_entity_form OR https://www.drupal.org/project/entityreference
- Create a second content type 'page' with an entity reference to the content type 'table'
- use inline entity form field widget for the entity reference.
- create a new node "page", create inside the widget your referenced node "table"
- save
- edit the node page, edit the node "table" inside the widget
- Default values are missing in the widget but are in database.

A test in widget_form() assert that the default values will be loaded from the entity object only if the form doesn't have in form_state any clicked button values.
The solution is to test only against named button if clicked button value are present.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

delta’s picture

Issue summary: View changes
FileSize
799 bytes
delta’s picture

vitalie’s picture

thx @delta. I could reproduce this and the patch fixes the issue, however it introduces a regression bug as described here: #1673416: Image upload interferes with Rebuild table

delta’s picture

Status: Active » Needs work

Ok i need to try the step in #1673416 against the patch in this issue.

boesbo’s picture

Tablefield has issues with entity_reference. With the patch I fixed:
- edit a node with an entity reference field and with the referenced node with tablefield.

boesbo’s picture

Issue summary: View changes
mrkprod’s picture

This patch works for me... for empty edit of existing tables loaded in ajax..

Thanks!

johnny5th’s picture

This patch works for me, but for latest dev, the first hunk fails (it's just an empty line deletion)

vitalie’s picture

Status: Needs work » Needs review
FileSize
6.88 KB

Thank you @BOESbo for #5. The patch, but also Issue #2615188: Data loss when multiple tablefields are attached via Paragraph bundles, shows that the code in the widget_form functions is getting a bit heavy, so I had a go at refactoring a bit. I think it's better now. But needs testing again.

@johnny5th, it should apply cleanly to latest dev.

  • vitalie committed 49367e0 on 7.x-2.x
    Issue #2493563 by delta, vitalie, BOESbo, Issue #2615188 by broeker,
    
vitalie’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.