- Issue created by @vlooi vlerke
- πΏπ¦South Africa vlooi vlerke
Removing the call for Modernizer reveals more errors
Uncaught TypeError: $context.find(...).once is not a function
line 30: $context.find('input[data-drupal-date-format]').once('datePicker').each(function ()
And
Uncaught TypeError: $(...).find(...).findOnce is not a function
Line:99 $(context).find('input[data-drupal-date-format]').findOnce('datePicker').datepicker('destroy');
- Status changed to Needs review
about 1 year ago 6:57am 19 February 2024 - πΏπ¦South Africa vlooi vlerke
To Fix: Uncaught ReferenceError: Modernizr is not defined at timeslots.js
Add:
timeslots: js: js/timeslots.js: {} css: theme: css/timeslots.css: {} dependencies: - core/jquery - core/drupal.date + - core/modernizr - jquery_ui_datepicker/datepicker
To: commerce_timeslots.libraries.yml
Clear cache.
This will fix the error but the next error will apper
Uncaught TypeError: $context.find(...).once is not a function
- πΏπ¦South Africa vlooi vlerke
to get rid of
Uncaught TypeError: $context.find(...).once is not a function
change line 30:
$context.find('input[data-drupal-date-format]').once('datePicker').each(function ()
to
$(once('input[data-drupal-date-format]', 'datePicker', context.find)) .each(function () {
This removes the error but it is not fixing the issue. Date picker is not loaded and a user can not select a date.
tried adding - core/once as a dependency but did not work
- πΊπΈUnited States generalredneck Texas, USA πΊπΈ
Additionally... based on https://www.drupal.org/node/3333253 β Modernizer library is deprecated as of Drupal 10.1.0.
- πΊπΈUnited States generalredneck Texas, USA πΊπΈ
The other issues are going to be a part of https://www.drupal.org/node/3158256 β . Back in 9.2.0 Drupal core deprecated jquery once and the BC layer was removed from Drupal 10 completely.
I'm going to try and get a patch/mr in place. Moving this to Needs work as there is no patch or MR to review currently.
- Merge request !8trying to fix modernizr and jquery once errors β (Merged) created by generalredneck
- πΊπΈUnited States generalredneck Texas, USA πΊπΈ
Ugh, Javascript isn't my strong point. I'm really a backend developer.
I've managed to get rid of the errors, but I don't know how it's SUPPOSED to work.
There's no input field with data-drupal-date-format. So the datepicker isn't getting instantiated and the ajax calls aren't being hit on the date change...
I'm going to have to let someone else work on this part. I'm pushing up what I've done so far.
- πΊπΈUnited States generalredneck Texas, USA πΊπΈ
I believe what I may have been experiencing while working on this issue is related to β¨ Timeslot Widget does not update after a new date is set Active ...
We may have to break it down to see what we can get working... still JS work... still not my wheelhouse :/
- πΊπΈUnited States generalredneck Texas, USA πΊπΈ
Alright... I can confirm that the data-drupal-date-format attribute is no longer being added to the date field for what ever reason. My quick fix for this is to FORCE the attribute to be set to a fixed value. this specific piece was reported in β¨ Timeslot Widget does not update after a new date is set Active . That said, there was ALSO the 2 deprecations of Jquery Once and Modernizr. I've fixed the code so that it implements the recommendations based on the documentation at https://www.drupal.org/node/3158256 β . The comments above had the arguments swapped... therefore, my first commits to this MR did as well.
I've got the date picker working again as you can see in the screenshot and the dropdowns change value.
- π²π©Moldova andrei.vesterli Chisinau
Hey @generalredneck, left a few comments, the rest is just perfect! Can you please address those so i can merge the MR and move forward?
p.s. i want to prepare a new release that will include these last merged MRs into the dev branch. - πΊπΈUnited States generalredneck Texas, USA πΊπΈ
Makes sense. I didn't know there was a suggested changes feature in Gitlab... Neat. I applied them.
I want you to make a release too so I can continue working on McGreen Acres ecommerce solution! π
I put in a bunch of work just to try this thing out and I think it's gonna pay off!
-
andrei.vesterli β
committed 8bb5ae02 on 1.0.x authored by
generalredneck β
Issue #3421582: Uncaught ReferenceError: Modernizr is not defined at...
-
andrei.vesterli β
committed 8bb5ae02 on 1.0.x authored by
generalredneck β
- π²π©Moldova andrei.vesterli Chisinau
Heh....I am here for some support ;). I wrote this module a while ago...Don't have much time to support/maintain it but if it may help with your project, good luck man! You've done a lot already!
Yeah, I will push a new release to stabilize things around.