I created a "Smart date range" field with the configuration in the screenshot.
My problem :
When I click on the "Add another item" button, nothing happens. Double-click the button to add another item.
After the following works correctly with a single click.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | After-patch-3322456-10.gif | 575.28 KB | djsagar |
| #12 | Before-patch-3322456-10.gif | 241.99 KB | djsagar |
| #11 | smart_date-add_button-3322456-10.patch | 875 bytes | mandclu |
| #4 | Screenshot 2022-11-24 13.13.17.png | 88.24 KB | zenimagine |
| Screenshot 2022-11-18 12.09.53.png | 20.91 KB | zenimagine |
Comments
Comment #2
zenimagine commentedThere are no errors in the logs or in the console.
Comment #3
mandclu commentedWorks fine for me on a clean install of Drupal. I'll need more detailed steps to reproduce before I can work on this.
Comment #4
zenimagine commentedThere are no errors or warnings in the logs or in the console. Here is my server configuration.
Comment #5
zenimagine commentedHere is a video of the abnormal behavior :
https://webm.red/view/0Hme.webm
Comment #6
hhvardan commentedI can confirm that the issue exists.
I've checked 3.7.0-beta version on both 9 and 10 Drupal versions.
Also, when the "Allowed number of values" is equal N which is greater than 1, the form displays N-1 items.
I think both issues related to each other.
Comment #7
hhvardan commentedThis happens because of the following added into the \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase::formMultipleElements function.
This change is related to the this issue #3166698: Option to not show an empty field by default
Comment #8
tostinni commentedStill happening on Drupal 10.1 and Smart Date 4.0.3
Comment #9
mandclu commentedI was able to figure out that this happens when no default value is set, which is why I wasn't able to reproduce it before, using "Next hour" as the default. I will work on a fix.
Comment #10
mandclu commentedHere's a patch that should get the button working as expected with and without a default value.
Comment #11
mandclu commentedHelps if I actually attach the patch file lol
Comment #12
djsagar commentedAfter applied patch #11, issue is resolved shared attachment for reference.
Please review.
Regard!
Comment #14
mandclu commentedThanks all. I'm glad we were able to get to the bottom of this one.