JS error in signature pad

Created on 31 August 2023, 10 months ago
Updated 8 September 2023, 10 months ago

Problem/Motivation

Unable to upgrade from version 8.x-1.0-rc1. Signature data field is visible but signature pad is not, JS error attached.

Steps to reproduce

Existing site with a content type that includes a signature field v1.0-rc1 field.

Upgrade the module manually or via the GUI and the update succeeds with no database updates required.

Access the node edit page for the content type.

🐛 Bug report
Status

Needs review

Version

2.1

Component

Code

Created by

🇦🇺Australia dalpasso

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

Comments & Activities

  • Issue created by @dalpasso
  • First commit to issue fork.
  • 🇮🇳India shubham_jain

    Hi @dalpasso, The updated version does not contains .install file so no hook update happened. Therefore this version is same as the latest version.

    I am not able to get this error and version update does not contain any additional code. So, I am unable to identify the problem.

    Please explain it briefly that what are you doing.

  • 🇦🇺Australia dalpasso

    Hi and thanks for your reply @shubham_jain I will try to explain the situation a little more:

    D9.5.10, Signature Field 8.x-1.0-rc1

    We have an existing form with a working signature field. If I complete an upgrade via the GUI (no composer etc.) to version 2.1 and try to load the same form the signature panel is not visible. No errors in logs and can submit the form with no errors but unable to take a signature as only the data field is visible.

    If I look in the console I see the js error with signature_pad, line 88, Uncaught TypeError: t is undefined.

    I also noticed that if I try to edit the form display to hide the signature data filed it is not hidden and the form is unchanged.

  • 🇦🇺Australia dalpasso

    Hi @shubham_jain,

    I have done a test on a fresh install of D9.5.10 and have seen that the color (deprecated) module is enabled when installing v8.x-2.1. This would not happen when doing an upgrade in my environment so I think this explains the undefined t console error. I'll remove it from the issue.

    v3.0.3 doesn't seem to need color, but it's pad is not visible on the edit content screen. The data portion is enabled by default and if I disable the data portion all I get is the field title on the edit screen. The "undefined (reading 'getContext') error is visible in the console window.

  • 🇦🇺Australia dalpasso

    Hi @shubham_jain,

    I'm not sure if this is a correct solution but I noticed that the template was not being loaded. I've added the theme in to the SignatureWidget class which has loaded the signature pad correctly.

    $element += [
    '#theme' => 'signature',
    '#type' => 'textarea',
    '#default_value' => $value,
    '#attributes' => $sign_data_attributes,
    '#attached' => [
    'library' => ['signature_field/signature_pad'],
    ],
    ];

    I can't submit the form in my environment right now but do you think this is a safe solution to implement?

    Thanks,

  • Status changed to Needs review 10 months ago
  • 🇮🇳India shubham_jain

    Hi @dalpasso, sorry for the late reply.

    This approach is right because it will only attach library if the field type is textfield.

  • 🇮🇳India shubham_jain

    Hi @geoanders and @saranya ashokkumar, please review it.

Production build 0.69.0 2024