- π¬π§United Kingdom tce
I have installed and enabled this module, but when I put the below code into a custom form it does nothing - I also noticed the library assets are not loaded, so I feel like it's not doing anything. Is there anything else I need to do to make this work?
<?php $form['signature_field'] = [ '#type' => 'signature', ]; $form['signature_data'] = [ '#type' => 'hidden', '#attributes' => [ 'id' => ['signature_data'], ], ]; ?>
- π¬π§United Kingdom tce
I finally got this working using the code below. It seems like the selector isn't there in the code example, so wrapping in a
<div class="signature">
was needed. Also, the signature_data element selector is wrong in the example, the id issignature-data
and notsignature_data
<?php $form['signature'] = [ '#type' => 'container', '#prefix' => '<div class="signature">', '#suffix' => '</div>', ]; $form['signature']['signature_field'] = [ '#type' => 'signature', ]; $form['signature']['signature_data'] = [ '#type' => 'textarea', '#attributes' => [ 'id' => ['signature-data'], 'class' => [ 'signature-data', ], ], ]; ?>