Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When adding a new line item to the widget, nothing happens.
Steps to reproduce
- Enable Payment form +dependecies
- add the payment form field to any entity form
- create or edit an entity with that field
- click Add and configure a new line item
Expected result
New line item form should appear.
Actual result
nothing…
Proposed solution
see patch
Comment | File | Size | Author |
---|---|---|---|
#28 | ajax-broken-2840698-28-interdiff.txt | 638 bytes | Berdir |
#28 | ajax-broken-2840698-28.patch | 15.42 KB | Berdir |
#27 | ajax-broken-2840698-27-interdiff.txt | 4.08 KB | Berdir |
#27 | ajax-broken-2840698-27.patch | 15.06 KB | Berdir |
#26 | ajax-broken-2840698-26.patch | 11.46 KB | Berdir |
Comments
Comment #2
Ayrmax CreditAttribution: Ayrmax commentedComment #3
Ayrmax CreditAttribution: Ayrmax commentedImproved the id generation to make it more unique by adding the element parents to it.
Comment #4
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commentedHi there !
I can confirm fix_ajax-1.patch works fine for me.
Thanks
Comment #5
pablitt CreditAttribution: pablitt commentedI can confirm fix_ajax-1.patch works for me too. I hope it gets implemented in the main module soon!
Comment #6
ChristopheDG CreditAttribution: ChristopheDG commentedSame here, can't wait!
Comment #7
bendev CreditAttribution: bendev at WebstanZ commentedthe patch works for me too
Comment #8
mickaelperrin CreditAttribution: mickaelperrin as a volunteer commentedCan confirm also that the patch worked for me too.
Comment #9
anpolimusConfirming, that patch #1 is working for me.
Comment #10
BerdirSorry 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.
Comment #11
firfin CreditAttribution: firfin commented@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?
Comment #12
BerdirWhat 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.
Comment #13
vaza18 CreditAttribution: vaza18 at FFW commentedHi @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).
Comment #14
vaza18 CreditAttribution: vaza18 at FFW commentedComment #15
vaza18 CreditAttribution: vaza18 at FFW commentedComment #17
vaza18 CreditAttribution: vaza18 at FFW commentedComment #18
vaza18 CreditAttribution: vaza18 at FFW commentedComment #19
vaza18 CreditAttribution: vaza18 at FFW commentedComment #20
vaza18 CreditAttribution: vaza18 at FFW commentedComment #21
vaza18 CreditAttribution: vaza18 at FFW commentedComment #22
vaza18 CreditAttribution: vaza18 at FFW commentedComment #23
vaza18 CreditAttribution: vaza18 at FFW commentedComment #25
bwoods CreditAttribution: bwoods at Johns Hopkins University commentedI haven't completed extensive testing, but so far #23 works for me. Thanks for posting!
Comment #26
BerdirReroll.
Comment #27
BerdirThis 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.
Comment #28
BerdirFixing the remaining unit test fail.
Comment #29
BerdirCommitted.