Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Digital Signature check

Avatar

Former Community Member
I need to check if a document is digitally signed before the user hits the submit button.



I am trying the foloowing code:

if (SignatureField.rawValue == null)

{

// alert the user and exit;

}



Do you think if the code in the 'if' statement is correct? Should I be using the rawValue property or something else?



Any help would be highly appreciated.
10 Replies

Avatar

Former Community Member
This is not as easy as it sounds. The Signature is not a real field that you can get its value out of....so doing a rawValue on it is not an option. I am not sure how to go about this but I will look into it and see what I can find.

Avatar

Former Community Member
Paul,



All I need to do is check if the signature field has a signature. I am not worried about it being valid or approved at this point.



Is there any property of the signature field (like any name, or string content of the signature) that I can use to verify that the signature field is not empty/null?



Thank you!

Avatar

Former Community Member
You can try the following script:

function isValid() {



/* signatureValidate method returns one of the following integer validity status values:

-1: not a signature field

0: signature is blank

1: unknown status

2: signature is invalid

3: signature is valid, identity of signer could not be verified

4: signature and identity of signer are both valid

*/



//List of Signature fields

var a= event.target.getField("form1[0].page1[0].SignatureField1[0]");

// Validate the signature field:

var status = a.signatureValidate();



// Obtain the signature information

var sigInfo = a.signatureInfo();



if (status < 3){

//var msg = "Signature is not valid: " + sigInfo.statusText;

var msg = "Signature on Page 1 is required " + sigInfo.statusText;

app.alert(msg);

return false;

}

else {

var msg = "Signature is valid: " + sigInfo.statusText;

// Display the status message:

app.alert(msg);

return true;

}

}

Avatar

Former Community Member

Several rookie questions about this solution, as I cannot get it to work.  I tried placing this code under a button::click action and then calling the function right after it.  This did not work... so where should I place the function so I can call it at a button::click action.

Avatar

Former Community Member

You would place that function in a Scripting Object. In the hierarchy view right mouse click on the root object (usually form1) and choose Insert Scripting Object. A new variables node will appear with a child node called "Untitled Script Object". Give your Script Object a name (myScriptObject) then click on it. In the Script Editor all events will be greyed out but you can copy your function into that screen. Now when you call your function you woudl use:

myScriptObject.functionName()

Hope that helps

Paul

Avatar

Former Community Member

Hi, I failde with mssg:

Error: An attempt was made to reference property (..) of a non-object in SOM expression (..)

What seems I have wrong object reference, am I right? I´ve read some articles here about som expressions, but still not able to create correct expression.

Avatar

Former Community Member
I have a new problem now. I don't want all the fields to be locked after the signature is applied. I created a selection of objects but I am not being able to select it.



Any suggestions?