Uncaught TypeError: $context.find(...).once is not a function

Created on 16 November 2023, 8 months ago
Updated 23 November 2023, 7 months ago

jQuery.once is removed in the D10, hence it need to be replaced by Drupal core's once library https://www.drupal.org/project/once .

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India Sharique

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Sharique
  • First commit to issue fork.
  • @sijumpk opened merge request.
  • @sijumpk opened merge request.
  • @sijumpk opened merge request.
  • Status changed to Needs review 8 months ago
  • 🇮🇳India sijumpk

    Added javascript adjustments to solve jquery once issue. In D10, form element class name changed to "form-type--color-picker". So adding CSS adjustments also to the changes.

  • 🇮🇳India sijumpk

    @scot.hubbard, you should either drop drupal D8 compatibility for the new version or make some alterations. Now its showing a javascript error in D8.

    Uncaught ReferenceError: once is not defined
        at color_picker.js?0:43:20
  • Status changed to Needs work 8 months ago
  • 🇮🇳India Sharique

    Thanks for quick fix, it is working.
    I've one question, I see that form field takes color values as input, but in my case I don't want to provide any values. Content editor can pick any value. How I can achieve this?

  • Status changed to Fixed 8 months ago
  • 🇬🇧United Kingdom scot.hubbard Fenay Bridge, Huddersfield

    Thanks for pointing that out Sharique - I have now diverged the code into two branches for D8/9 and for D10. D8/9 has been reverted to the version of the code prior to today's fix.

    Regarding your question, the module is not intended to allow selection of any colour, it is only for use where there is a defined colour palette, hence specifying the hex codes for the field. I'm pretty sure there are other colour picker modules out there that will give you what you need though.

  • 🇮🇳India Sharique

    Thanks Scott for quick reply, yes there modules which provides the field. What I'm looking the the color field form element to integrate in layout options, which I didn't find so far.

  • Status changed to Fixed 7 months ago
  • 🇬🇧United Kingdom scot.hubbard Fenay Bridge, Huddersfield
Production build 0.69.0 2024