You are viewing limited content. For full access, please sign in.

Question

Question

Prevent Signature Fields From Clearing When Form is Loaded

asked on April 18, 2023 Show version history

Does anyone know how to prevent the signature fields from being cleared automatically when the form is loaded, if the signature is not set to read-only?

Version 11.0.2212.30907 - Forms Layout Designer.

I have a really complex form I'm recreating in the Forms Layout Designer, and it includes more than a dozen signature fields.  It's not feasible in this use case to have a different version of the form for each signature to be editable and leaving them readonly in other cases.  Not to mention that sometimes a single user will be completing multiple signatures, and they want to do it in a single user task - and I definitely can't make a different form for every possible combination of signatures that may be needed in a situation.

I'm hitting this wall where the signature fields that were previously completed are being cleared whenever I load a new user task unless I have made the signatures read-only.

I tried using the field rules to decide when to make the fields enabled/disabled, that worked to disable them, but they were still cleared.

No other fields are being reset on each user task the way the signature is being reset.  Is there any way to prevent that?

1 0

Answer

SELECTED ANSWER
replied on April 19, 2023

Here's the really annoying workaround I'm doing now.  This is annoying, but it is better than having a dozen copies of the same form just so that I can make one signature editable on each version.

For each signature field, I had an associated checkbox field that the signer is marking a decision "Approved, Denied, etc.". 

I've expanded to add two additional fields: a second signature field, and a single line field.  So now every signature has four fields:

  1. Checkbox field to set the user's decision.  This field is enabled or disabled based on Field Rules triggered by the specific Process Step, so it can only be changed when it is appropriate.
  2. A Single Line field.  Javascript triggered by changes to the Checkbox field, will populate the word TRUE into the single line field.  The Single Line field has a Field Rule to Hide Always but to save the value.
  3. The first Signature field is set to read only.  This has a Field Rule to hide it when the Single Line field has a value of TRUE.
  4. The second Signature field is set as editable.  This has a Field Rule to show it when the Single Line field has a value of TRUE.
    • Note that both signature fields have the same label, so they appear basically identical.

 

Then I have a Workflow that runs after every task submission that pulls in the value of every single Signature field and the associated Single Line fields.  It checks the Single Line field to see if it says TRUE, and if it does, it copies the value from the associated editable Signature field into the associated read only Signature field, and clears the value in the editable Signature field and the Single Line field.

The practical upshot of all this is that:

  • Uless you are on a User Task that allows you to edit the decision Checkbox field, you only see a read-only Signature field.
  • And if you don't edit the decision Checkbox field, you still only see a read-only Signature field.
  • And if you change the decision Checkbox field, it appears at that point that the Signature field is cleared and you are now allowed to populate a new signature into the field.
2 0
replied on February 13 Show version history

 Your post definitely fueled my inspiration to try an alternative (especially for Cloud). It's fairly code intensive, but it retains Signatures using only a single HTML Field, a signature field for each user, and a hidden single line field for each user (no workflows and only a single form).

  A note that this process is completely internal and none of those users even know how to get to the developer console (not sure if the following practices are best for security).

 1) First, we assign many user tasks the same single form through a Parallel Gateway.

2) Second, we design a form with an HTML field to get the current user with the following code:

 a) Inside the HTML <> itself: {/_currentuser}

// b) Then, for the JS on the Form (cloud):
const htmlField = xxx // Hidden HTML Field Id - your integer number here!!
const currentUser = LFForm.findFields(f => f.fieldId === htmlField)[0].settings.default // HTML field that holds Current User (String)
LFForm.hideFields({fieldId: htmlField})

// 3) Third, we'll also name all the fields we use on the form (just an easy way to not keep reusing fieldId's)
// Department Signature COLLECTION
// User1
const _user1Sign = {fieldId: xxx} // Required Signature FieldId Number
const _user1SignText = {fieldId: xxx} // Single Line Signature Link Saver
// User2
const _user2Sign = {fieldId: xxx} // Required Signature FieldId Number
const _user2SignText = {fieldId: xxx} // Single Line Signature Link Saver
// User 3
const _user3Sign = {fieldId: xxx} // Required Signature FieldId Number
const _user3SignText = {fieldId: xxx} // Single Line Signature Link Saver

// a) Then, let's hide all the text fields:
LFForm.hideFields(_user1SignText, _user2SignText, _user3SignText)

// 4) Fourth, in the Cloud JS, we need to call a function we'll use:
forSignatures()

// a) Then, we'll actually write our forSignatures() function:
function forSignatures () { console.log("===FUNCTION: forSignatures() CALLED: ", currentUser)

    let [ user1SignText, user2SignText, user3SignText ] = [ LFForm.getFieldValues(_user1SignText),
        LFForm.getFieldValues(_user2SignText), LFForm.getFieldValues(_user3SignText) ]

    // Testing
    console.log (user1SignText, user2SignText, user3SignText);

    // Program using switch statement
    switch (currentUser) {
        case "<User1 Username> ": // Change the form if User 1 is viewing:
            LFForm.changeFormSettings({title: "User 1's Form Title", description: "Form for User 1."}); // Rename Form
            LFForm.hideFields(_user3Sign, _user2Sign) // This can be altered IF full later...
            LFForm.enableFields(_user1Sign) // So the current user can sign their current field

            // Optional You may want to add Highlighted CSS classes to where the User should sign.
            LFForm.addCSSClasses(_user1Sign, "yellowHL");
            LFForm.removeCSSClasses([_user3Sign, _user2Sign], "yellowHL"); 

            // Make sure the User's Signature is always captured for the Saved Single Line (Hidden)
            LFForm.onFieldChange(()=> updateSignature(_user1Sign, _user1SignText), _user1Sign)

            // If the current user overwrites the wrong fields...
            if (user3SignText) {
                LFForm.onFieldChange(()=> updateSignature(_user3SignText, _user3Sign), _user3Sign)
                updateSignature(_user3SignText, _user3Sign)
                LFForm.showFields(_user3Sign)
            }
            if (user2SignText) {
                LFForm.onFieldChange(()=> updateSignature(_user2SignText, _user2Sign), _user2Sign)
                updateSignature(_user2SignText, _user2Sign)
                LFForm.showFields(_user2Sign)
            }
            break;

        case "<User2 Username> ": // Similar to User 1 except adjusted values for User 2.
            LFForm.changeFormSettings({title: "User 2's Form Title", description: "Form for User 2."}); // Rename Form
            LFForm.hideFields(_user1Sign, _user3Sign)
            LFForm.enableFields(_user2Sign)
            LFForm.addCSSClasses(_user2Sign, "yellowHL");
            LFForm.removeCSSClasses([_user3Sign, _user1Sign], "yellowHL"); 
            LFForm.onFieldChange(()=> updateSignature(_user2Sign, _user2SignText), _user2Sign)
            // If the current user overwrites the wrong fields...
            if (user3SignText) {
                LFForm.onFieldChange(()=> updateSignature(_user3SignText, _user3Sign), _user3Sign)
                updateSignature(_user3SignText, _user3Sign)
                LFForm.showFields(_user3Sign)
            }
            if (user1SignText) { LFForm.onFieldChange(()=> updateSignature(_user1SignText, _user1Sign), _user1Sign)
                updateSignature(_user1SignText, _user1Sign)
                LFForm.showFields(_user1Sign)
            }            
            break;

        case "<User3 Username> ": // Similar to User 1 except adjusted values for User 3.
                LFForm.changeFormSettings({title: "User 2's Form Title", description: "Form for User 2."});
                LFForm.hideFields(_user2Sign, _user1Sign)
                LFForm.enableFields(_user3Sign)
                LFForm.addCSSClasses(_user3Sign, "yellowHL");
                LFForm.removeCSSClasses([_user2Sign, _user1Sign], "yellowHL"); 
                LFForm.onFieldChange(()=> updateSignature(_user3Sign, _user3SignText), _user3Sign)
                // If the current user overwrites the wrong fields...
                if (user2SignText) {
                    LFForm.onFieldChange(()=> updateSignature(_user2SignText, _user2Sign), _user2Sign)
                    updateSignature(_user2SignText, _user2Sign)
                    LFForm.showFields(_user2Sign)
                }
                if (user1SignText) { LFForm.onFieldChange(()=> updateSignature(_user1SignText, _user1Sign), _user1Sign)
                    updateSignature(_user1SignText, _user1Sign)
                    LFForm.showFields(_user1Sign)
                }     
                break;
        default: // In case something breaks...
            LFForm.changeFormSettings({title: "ERROR: Username Unrecognized", 
                description: "Please Contact your Records Analyst to resolve this issue."});
            LFForm.disableFields(_user3Sign, _user2Sign, _user1Sign)
            LFForm.removeCSSClasses([_user3Sign, _user1Sign, _user2Sign], "yellowHL"); 
            break;
    } 
}

// 5) Lastly, you may notice a function used that we'll have to define called updateSignature()
function updateSignature (_signField, _signSave) { console.log("===FUNCTION CALLED: updateSignature()", _signField, _signSave)

    let newSignature = LFForm.getFieldValues(_signField)
    let saveSignature = LFForm.getFieldValues(_signSave)
    if (newSignature.length > 0) { if (saveSignature !== newSignature) LFForm.setFieldValues(_signSave, newSignature); }
}


In my testing, no additional workflow is needed to save / display signatures as they are input (not to mention I could NOT get a workflow to do what I wanted, as the signature variables weren't selectable in my business process?? I also didn't want to do some fetching from field values on saved forms or something weird ). Also, the updateSignatures() function imputes the signature field and FORCES an update to the default value if the wrong user tries to overwrite it. 

I also had an onSubmission function... but I'm thinking it's deprecated with this method when the signatures are required fields. 

 I'm sure there's optimizations available depending on how many users you have, I just had 3 though and found the idea of multiple forms / workflows exhausting.

0 0

Replies

replied on April 19, 2023

This continues to be a huge pain point as well. Maintaining copies of forms for users who require specific signatures really hampers the agileness of forms development.

 

Please put in a checkbox where once it is signed it is read only unless returned to that step. This would work for 90% of my signature flows.

4 0
replied on April 18, 2023 Show version history

This is a request that goes all the back to 2014 and I have not heard of any good options since to this day.

2 0
replied on April 18, 2023

I was afraid you were gunna say something like that Blake.

0 0
replied on April 18, 2023

Ugh, and in a table, the signature field can't be set to "Previous data or new lookup data will be read-only, but user-added sets will be editable" - it has to be set to "Read-Only" or it still clears the signature.

So there is no option except to have multiple copies of this form (this very complex form), one version for each individual signature, so that they can be editable once, and not other times.  And when a user needs to do four or five of the signatures, I'm going to have to assign them four or five tasks.

Wow.  Excuse me while I hit my head against this brick wall repeatedly.  Ugh.

Most of my processes haven't been an issue to have a dedicated approval version of the form, but this particular form just won't work that way.

0 0
replied on April 19, 2023

This may be an issue with the legality of the signature box in some circumstances and how the digital fingerprint is tied to the original submitter so if it is not readonly on the next task it is cleared. I'll check in with the team and see if this is expected behavior. It might be nice to have a flag on signature fields "isSigned" so you can disable the field via field rules (e.g., disable 'Signature' if all of the following are true, 'Signature.isSigned' = True && 'Process Step' is User Task. Although it looks like the fields are cleared on disable too.

 

Are your tasks flowing through the same individuals? Would a flow like this work for your form? 

2 0
replied on April 19, 2023

I would love it if the Field rules could dictate when it is readonly and when it is editable based on things like the Process Step.  As it works currently, we can disable the field with field rules, but it still clears the signature even though it is disabled.

2 0
replied on April 19, 2023

I mentioned this in my 2014 request, but if we can have the ability to do what you and Matthew have described with Field Rules or on the field itself to just say 'Signature.isSigned' = True then don't delete the value, that would be great. The new Field Rules would probably be a better place for it now because it allows greater flexibility.

3 0
replied on April 18, 2023

I thought I would try to set the fields as Read-Only initially and then use Javascript to remove the readonly status.

I can make a script that will edit a setting on all of the Signature fields on the form, like this one that changes all of their labels: 

var myFields = LFForm.findFields(function(field) { return field.componentType === "Signature"; });
myFields.forEach(function(arr) {
  LFForm.changeFieldSettings(arr, {label: "New Label"});
});

 

It was a nice idea, but I couldn't get it to work.

Unfortunately, the LFForm.changeFieldSettings interface doesn't have readonly as one of the settings that it will let you change, so trying to set readonly to false doesn't do anything. sad

//THIS DOES NOT WORK
var myFields = LFForm.findFields(function(field) { return field.componentType === "Signature"; });
myFields.forEach(function(arr) {
  LFForm.changeFieldSettings(arr, {readonly: "false"});
});

 

1 0
replied on April 17

test

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.