Problem/Motivation

When using the simple widget the "Add another item" does not work the first time it is submitted but doesn't work the second time with no changes.

Step to reproduce:

  1. add $settings['extension_discovery_scan_tests'] = TRUE; to settings.php
  2. enable inline_entity_form_test
  3. navigate to /node/add/ief_simple_single
  4. Fill in the title for the inline entity form
  5. Click "Add another item"
  6. Another item widget does not appear(it should) and no error is displayed or is in the logs
  7. Click "Add another item" again
  8. Another item widget DOES appear

Comments

tedbow created an issue. See original summary.

tedbow’s picture

Assigned: tedbow » Unassigned

Unassigning myself. I took a quick and couldn't figure it out. I will get back to it but not actively looking at it now

slashrsm’s picture

StatusFileSize
new1.04 KB

#2568991: Improve tests for IEF simple field widget was committed and includes workaround for this issue in test. Attached patch shows that test fails if we remove that workaround. Goal of this issue is to make the test green.

slashrsm’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: 2664626_3_TEST_ONLY.patch, failed testing.

tedbow’s picture

Title: Add another item does work the first time it is clicked on simple widget » Add another item does NOT work the first time it is clicked on simple widget

fixed title

The last submitted patch, 3: 2664626_3_TEST_ONLY.patch, failed testing.

tedbow’s picture

Ok finally think I figured this out.

Re-rolled the TEST_ONLY patch but it is the same as before.

I wanted to test this with a nested simple widget but I get a "Maximum function nesting level" and increased the limit to 1500 and then I get a memory error. I don't think we have tested nesting the simple widget so this is probably a separate issue.

tedbow’s picture

Status: Needs work » Needs review

The last submitted patch, 8: ief-add_another-2664626-8-TEST_ONLY.patch, failed testing.

bojanz’s picture

Well, if you nest the simple widget on the same entity type/bundle, you'll get an endless loop :)
We should protect against that.

skyredwang’s picture

I tested ief-add_another-2664626-8.patch, it works well. What else needs to be done in this issue?

tedbow’s picture

StatusFileSize
new2.4 KB
new810 bytes

@skyredwang thanks for testing. I made 1 small change so the patch would work when field is nested could you test this?

Thanks

skyredwang’s picture

when field is nested could you test this?

I don't know what situation is that.

See the screenshot, is this nested? It works with ief-add_another-2664626-8.patch already.

skyredwang’s picture

StatusFileSize
new65.79 KB

  • bojanz committed 93fc210 on 8.x-1.x authored by tedbow
    Issue #2664626 by tedbow, slashrsm: Add another item does NOT work the...
bojanz’s picture

Status: Needs review » Fixed

Committed, thanks.

skyredwang’s picture

Status: Fixed » Needs work
StatusFileSize
new63.29 KB

After I applied the latest patch, now IEF always opens an empty entity form, which won't pass validation. Is this something intended? Please see screenshot attached.

bojanz’s picture

Sounds like we need more tests then.

tedbow’s picture

After I applied the latest patch, now IEF always opens an empty entity form, which won't pass validation. Is this something intended? Please see screenshot attached.
You should always get an empty entity form if you have no current value in the field. This because the simple widget can only be used with required fields.

It looks like from your image that you are editing a parent entity where the IEF field has one value is that correct. In that case there should not be an empty IEF field when you edit the parent entity.

Is that what you are seeing? I can't reproduce this
@skyredwang can you give more details about the field setup? And how you are using IEF in this case? Also when do you see this? When you are editing? adding? when the field already has a value?

Also can you try the latest 8.x-1.x-dev or clone? You shouldn't need to apply the patch because this has been committed. I just want to make sure you have all latest changes.

thanks!

tedbow’s picture

I did see the problem @skyredwang was describing when writing this patch but I can't reproduce.

I made a issue for adding related test coverage to make sure it doesn't show up in the future #2685789: Add test coverage to ensure that empty entity form does not appear with simple widget when not expected.

tedbow’s picture

Status: Needs work » Fixed

I am marking this as fixed again.

The problem @skyredwang describes is different that this issue and I can not reproduce it.

@skyredwang if you have another issue please create a new one.
Thank,s

skyredwang’s picture

I tested the latest dev packaged on Mar.16th with a fresh Drupal 8.0.5 install. Inline editing form can no longer save any value for my commerce_stock module https://github.com/INsReady/drupal-commerce-stock

If I revert it back to Inline Entity Form 8.x-1.0-alpha4+27-dev (2016-Mar-01), then saving works again.

bojanz’s picture

@skyred
Please open a new issue for that, along with more details ("can no longer save" -> what does that mean? any error message/)

Status: Fixed » Closed (fixed)

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