Forgive me if this has already been addressed, but in the site I was developing using IEF, I ended up with submit handler on the order edit form firing out of order because (for some unknown reason) the Order UI's button level submit handler was being put into the order form's form level handler array and then IEF was combining these all together so that the Order UI handler ended up getting invoked first (which sets the redirect, basically) before the order was actually saved.

In other words, my submit handler array ended up looking like this:

0 => 'inline_entity_form_trigger_submit'
1 => 'commerce_order_ui_order_form_submit'
2 => 'commerce_order_order_form_submit'

Why that Order UI button handler is being put into the form level array is beyond me, but the behavior of this module is incorrect regardless. When a Drupal form is submitted, the form level submit handlers are only invoked if the triggering element doesn't have any button level submit handlers. Now, however, any form including an IEF will process with both its form level and button level submit handlers, even if it results in contradictory or out of order behavior (as in my case).

I think I understand why you've coded this the way you have - it appears you are simply trying to prevent the processing of entity forms via form level handlers and just always use button level handlers, moving the form level handlers to the button level handlers to achieve that behavior. You can probably get away with just checking first to ensure the $submit_element doesn't have any button level handlers before merging in the form level handlers, though I'd ultimately recommend only putting the IEF submit handler in one place or the other.

CommentFileSizeAuthor
#1 2187103.ief_form_alter.patch1.38 KBrszrama

Comments

rszrama’s picture

Status: Active » Needs review
StatusFileSize
new1.38 KB

This patch fixed the issue for me; it just implements my short term solution of only using one or the other set of submit handlers.

socialnicheguru’s picture

this also removes the 'cancel' button from the form.

rszrama’s picture

This patch does or the behavior already existent in IEF does?

socialnicheguru’s picture

sorry. the patch obscures the save and cancel buttons in an inline entity form. so if you make a mistake there is no way to cancel just the form

parasite’s picture

Please look at my patch at https://drupal.org/node/2206423 it was worked for me.

les lim’s picture

Came to the same conclusion as in the original report; patch in #1 works for me.

I'm also not experiencing the problem in #4; the inline form has both "Save" and "Cancel" buttons.

mjpa’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #1 looks good to me. Found the same issue in IEF today and was going to propose an almost identical patch.

Regarding the cancel button - it's showing fine for me and I don't see how the patch can affect it. IEF will remove the cancel button if the reference fiel requires a value and doesn't currently have one.

bojanz’s picture

Status: Reviewed & tested by the community » Fixed

This patch got forgotten :/ Now committed. Thank you everyone for your patience.

  • bojanz committed 7721f03 on 7.x-1.x authored by rszrama
    Issue #2187103 by rszrama: inline_entity_form_form_alter() incorrectly...

Status: Fixed » Closed (fixed)

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