When adding a new line item to the widget, nothing happens.

Steps to reproduce

  1. Enable Payment form +dependecies
  2. add the payment form field to any entity form
  3. create or edit an entity with that field
  4. click Add and configure a new line item

Expected result

New line item form should appear.

Actual result

nothing…

Proposed solution

see patch

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ayrmax created an issue. See original summary.

Ayrmax’s picture

Issue summary: View changes
Ayrmax’s picture

FileSize
691 bytes

Improved the id generation to make it more unique by adding the element parents to it.

Dom.’s picture

Status: Needs review » Reviewed & tested by the community

Hi there !
I can confirm fix_ajax-1.patch works fine for me.
Thanks

pablitt’s picture

I can confirm fix_ajax-1.patch works for me too. I hope it gets implemented in the main module soon!

ChristopheDG’s picture

Same here, can't wait!

bendev’s picture

the patch works for me too

mickaelperrin’s picture

Can confirm also that the patch worked for me too.

anpolimus’s picture

Confirming, that patch #1 is working for me.

Berdir’s picture

Status: Reviewed & tested by the community » Needs work

Sorry for the slow response here.

This was using form state because the ID was dynamic, but this didn't work anymore like that.

However, now the ID is predictable, so I think we should simplify this and drop the form_state set/get, should not be required anymore. Just return the ID.

firfin’s picture

Component: Code » User interface
Status: Needs work » Active

@Berdir: How could one 'predict' the ID? I personally do not have a clue. Shame that something so simplifiable is not happening. Would love to help out.

Also a very similar issue happens with the payment_reference_field submodule, see #3015819: Can not add line items to payment_reference_field. Maybe a higher level issue is needed here? Extract the code in both submodules to a more generic function?

Also, isn't this more of a UX issue?

Berdir’s picture

Component: User interface » Code
Status: Active » Needs work

What I mean is that get*Unique*Id() returns an ID that is different each time we call it. getId() does not, it will always return the same value for the same input.

So as I said, just remove the form_state stuff around it and simply return the value. If you want to help then update the patch :)

No, UX would be about a visual change to the user interface.

vaza18’s picture

Status: Needs work » Needs review
Related issues: +#3015819: Can not add line items to payment_reference_field

Hi @Berdir.
Take a look on this one.

It also resolves an issue with loosing line items, when user updates existing entity without touching previously created line items (I didn't find it reported anywhere).

vaza18’s picture

vaza18’s picture

Status: Needs review » Needs work

The last submitted patch, 14: 2840698-13-ajax-broken.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

vaza18’s picture

vaza18’s picture

Status: Needs work » Needs review
vaza18’s picture

vaza18’s picture

vaza18’s picture

vaza18’s picture

vaza18’s picture

Status: Needs review » Needs work

The last submitted patch, 23: ajax-broken-2840698-23.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

bwoods’s picture

I haven't completed extensive testing, but so far #23 works for me. Thanks for posting!

Berdir’s picture

Status: Needs work » Needs review
FileSize
11.46 KB

Reroll.

Berdir’s picture

This was a tricky one, the web test actually tested deleting, but explicitly asserted that the item isn't *not* deleted. Fixed that, but required quite a few changes in the test to make it work.

Berdir’s picture

Fixing the remaining unit test fail.

Berdir’s picture

Status: Needs review » Fixed

Committed.

  • Berdir committed b94b5b0 on 8.x-2.x
    Issue #2840698 by vaza18, Berdir, Ayrmax: Ajax broken in payment_form...

Status: Fixed » Closed (fixed)

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