Highlighted

Digital Signature check

Avatar

Guest

21-07-2008

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.

Replies

Highlighted

pguerett

21-07-2008

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.
Highlighted

Avatar

Guest

22-07-2008

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!
Highlighted

Avatar

Guest

22-07-2008

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;

}

}
Highlighted

Avatar

Guest

22-07-2008

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?
Highlighted

Avatar

Guest

20-04-2009

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.

Highlighted

pguerett

21-04-2009

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