Hello everybody.

I have an entity/bundle with these settings:

Entity: Ticket
Bundle: Ticket
Fields:


field_ref_ticket_cateogory
Field Type: Entity Reference
Target Entity: Ticket Category
Target Bundle: Ticket Category
Widget: Entity Form Inline

Edit a Ticket entity

field_ref_ticket_cateogory loaded normally
But on submit: it's not saved.

If I change the target type to Node, it works fine.

I debugged and found that inline_entity_form.module > inline_entity_form_process_entity_form()

http://drupalcode.org/project/inline_entity_form.git/blob/refs/heads/7.x...

if (empty($form_state['triggering_element']['#ief_submit_all']) && !in_array($triggering_element_name, array('ief_add_save', 'ief_edit_save'))) {
// …
}

This condition checking always return TRUE.

Comments

duynguyen’s picture

Priority: Normal » Critical
bojanz’s picture

Priority: Critical » Normal

What's the entity type on which you have the reference field?

I'm guessing that this fails:

  // Mark the parent form submit button with a special flag that will trigger
  // a save of inline forms and entity weights.
  $form['actions']['submit']['#ief_submit_all'] = TRUE;

because your form doesn't have $form['actions']['submit'].

duynguyen’s picture

Thank! now it worked

aptorian’s picture

IEF should probably try to check where the submit button is, because some modules, such as Entity Construction Kit, places the submit button at $form['submit'] rather than $form['actions']['submit']. In my case, I have a parent entity that references a collection of required child entities, embedded in its creation form with an inline entity form. The save button doesn't work without manually adding the #ief_submit_all property to the submit button.

aptorian’s picture

aptorian’s picture

of course I copied the wrong number for the issue... for correctness' sake

minoroffense’s picture

Status: Active » Needs review
bojanz’s picture

Status: Needs review » Fixed

!empty implies isset.

Committed a fix.

Status: Fixed » Closed (fixed)

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

huynhquangto@gmail.com’s picture

Have some error when click button submit.
ex: Notice: Undefined index: #ajax in ajax_form_callback() (line 379 of .../public_html/includes/ajax.inc).

kaizerking’s picture

This still not working, Latest dev version
create content type "A" there are no fields only title
create entity reference in field collection target entity type node
selected 'A' single value.
create a new field collection and create the content type A and save the field collection, the content type 'A' is not saved.

TuTToWeB’s picture

Still not working for ECK Entities.
Create new entity with ECK module
Add a IEF Widget into another enitity bundle (in my case, drupal commerce order), single value
Filling the form, but nothing is being save

bojanz’s picture

@#11 and #12
Field Collection and ECK integration are the job of those specific modules. You are free to open issues in their own issue queues.
ECK received IEF integration in #1689726: Add support for Inline Entity Form, you need the ECK 7.x-2.x-dev in order to use it.

TuTToWeB’s picture

StatusFileSize
new1.49 KB

Not true. It is actually an IEF bug.
I did some debugging today in my own in order to solve the problem and it is because of the #ief_submit_all flag.
My guess: I think the hook_field_widget_form is being called before that the calling function adds its ['action']['submit'].
In order to fix this (provisionally), I've add a flag to the whole form, called ['#ief_form'] and I've added a form_alter as following

function inline_entity_form_form_alter(&$form,&$form_state)
{ 
  if(isset($form['#ief_form'])&&($form['#ief_form']))
  {    
    // Mark the parent form submit button with a special flag that will trigger
    // a save of inline forms and entity weights.
    if (!empty($form['submit'])) {
      $form['submit']['#ief_submit_all'] = TRUE;
    }
    elseif (!empty($form['actions']['submit'])) {
      $form['actions']['submit']['#ief_submit_all'] = TRUE;
    }
  }  
}

This seems to work for me

TuTToWeB’s picture

Issue summary: View changes

New update

aaronbauman’s picture

Issue summary: View changes

TuTToWeB if you're still having this problem and you want your patch to be considered, you should re-open this issue with status "needs review"

Otherwise you should clarify why you supplied a patch for a closed issue.

oni.zerone’s picture

Status: Closed (fixed) » Active

Hello, the bug is still here,
i'm working with IEF 7.x-1.6 and ECK 7.x-2.0-rc8 and the inline entity form still not save entity when insert from ief.

nancydru’s picture

Status: Active » Closed (fixed)

Read #15 and open a new issue referencing this one.