How to prevent form from executing initialize and calculate event when digitally sign

Magus069

MVP

16-10-2018

Hi forum,

I would like to know if anyone have any idea on how to stop the whole form from executing any event when it is digitally sign.

The only idea I have is to create a checkbox which is checked when the form is locked and then input an if statement within each events... but that is not really the best method...

Accepted Solutions (0)

Answers (8)

Answers (8)

mouslander

17-10-2018

What do you base the change on the Initialize event on? are you just automatically changing it to french? You may have to set a state for the form. Something that will be read by the initialize event and not make the change once it is already set.

Magus069

MVP

19-10-2018

Alright I got it to work now... but not entirely

It seems to work only on the execution of the second initialize of the form, afterwards it still returns null.

Either in a click, initialize or calculate event, the getField returns null each time, it only returns the current signature status when the form is opened and initialize is fired twice because I execute initialize event of the form on docReady...

radzmar

MVP

18-10-2018

If getField() returns null, the SOM couldn't be resolved this method. This is propably because digSignature.somExpression returns a somExpression beginning with xfa[0].form[0].…. Enter a SOM expression beginning with the root node of your form (i.e. form1[0]).

Magus069

MVP

17-10-2018

Hi radzmar,

Thanks for taking time to answer to this issue, I've tried multiple times before to use a similar method to get a signature field status with XFA dynamic forms. The only thing I ended up receiving was a message saying for security measures it can't get signature status as if it needs a trusted function...

the code it's executing is the following :

Am I missing anything?

radzmar

MVP

17-10-2018

You can check the state of a signature field through a script an use the result to control if other script to be executed or not.

// Get the state of the signature field.

// NOTE: In XFA forms this works only by using getField() method with full SOM expresion, so keep the accessors [0]!

var oSignInfo = event.target.getField("form1[0].#subform[0].signature[0]").signatureInfo(),

    iSignState = oSignInfo.status;

// Execute only when form is unsigned

if (iSignState === 0 {

    // enter your code here

    …

}

Status Code Meaning

-1 Not a signature field

0 Signature is blank

1 Unknown status

2 Signature is invalid

3 Signature of document is valid, identity of signer could not be verified

4 Signature of document is valid and identity of signer is valid.

Magus069

MVP

17-10-2018

Right... I guess I should have done this way before...

at this moment, I just set the value according to the language previously set when saved... maybe I should have a general function to verify if it needs to be set, hopefully this is gonna do the trick..

Thanks

Although any other ideas are welcome... it would be best to prevent all events from executing in case someone enters a field and exit or click anything... I can't believe a digital signature does not handle this behavior...

Magus069

MVP

17-10-2018

On initialize event I change language EN/FR and calculate event changes the visibility of subforms...

When digitally sign nothing can be altered anymore, but when the form is re-opened all the code executes.

Even if nothing in the form changes at all, the form is considered altered for setting values even if it's setting them the same value they were...