Disable Fields After Form Is Signed

JavaScript to disable fields after signing the form.

Please drag and drop a JavaScript field on your form and add the following code:

// Add  fields  to disable component id
var components_to_disable = 'f80f-4a22-7b29,9239-4bf2-601f,e489-93cb-058d,71a9-bca9-0959,af8a-4b25-b34f';
// Signature field component id
var signature_field_id = '4d42-172e-5742';
// On signing signature using touchmove event for touchscreen devices
$( '#component-' + signature_field_id + ' .pad' ).on( 'touchmove click', function() {
  disable_when_signed( components_to_disable );
} );
// Function to  disable components with field id added in components to disable
function disable_when_signed( components_to_disable ) {
  // Create array of components and loop through the array
  var array_of_components = components_to_disable.split( ',' );
  // For each loop
  array_of_components.forEach( function( form_field ) {
    // Set custom attributes to disable fields input
    formyoula.form_fields[ form_field ].set( 'attributes', {
      options: [ {
        attribute: 'disabled',
        type: 'input',
        value: true
      } ]
    } );
  } );
}