Digitale Signatur - Speichern unterbinden?

Grundsätzliche Themen zur Bedienung, Erstellung von Formularen, Datenbankanbindung und Beispiele ...
F2k
Beiträge: 26
Registriert: 11.02.2010, 08:08

Digitale Signatur - Speichern unterbinden?

Beitrag von F2k » 08.03.2010, 08:06

So, ich habe jetzt eine Lösung:

Ich hoffe ich kann damit helfen:

 

Zuerst nachfolgendes Skript einfügen:

Code: Alles auswählen

//

// Script below obtained from: http://forms.stefcameron.com/2006/06/14/acroform-field-name-generator/

//

// Returns the fully-qualified name for the specified object.

// This means the name always specifies the index.

// Therefore, if the name is specified, it's "name[index]".

// If the name isn't specified, it's "#className[index]".

function GetVerboseFieldName(oNode)

{

// Unnamed nodes have default names which their class name

// ("subform", "field", etc.) with a "#" prefix.

// Unfortunately, oNode.name won't return this if the node

// doesn't have a specific name. It'll just return an empty

// string. Also, oNode.index will be undefined. If it weren't

// for oNode.index being undefined in this case, we could've

// done something like

// SOM = "#" + oNode.className + "[" + oNode.index + "]"

// but we'll have to use the somExpression property instead

// and extract the name out of it because this will return

// the "#" name with the correct index.

// Since somExpression returns the name and index for the

// object in all cases (whether the name is specified or

// not), we can use the following syntax in all cases:

var nPos = oNode.somExpression.lastIndexOf(".");

// If the field has a name, check to see if it has any periods in its name.

// If that's the case, they'll be escaped with backslashes and we need to

// look for another period.

if (oNode.name != null && oNode.name.length > 0)

{

while (nPos > 0)

{

if (oNode.somExpression.charAt(nPos - 1) == "\\\\")

{

// we found an escaped period, keep looking

nPos = oNode.somExpression.lastIndexOf(".", nPos - 1);

}

else

{

// stop looking since we have an unescaped period

break;

}

}

}

if (nPos >= 0)

{

// get everything after the last "." to the end

return oNode.somExpression.substr(nPos + 1);

}

else

{

// in this case, the SOM expression is a single name (unlikely

// but theoretically possible)

return oNode.somExpression;

}

}

// Returns the Fully-Qualified SOM Expression for the specified field.

function GetFQSOMExp(oField)

{

var sFQFieldName = GetVerboseFieldName(oField);

var oParentNode = oField.parent;

// The absolute root of the XFA Object Model is the xfa object

// which contains a single form object, which then contains

// what the Hierarchy palette shows as being the "root

// subform" ("form1" by default). So we stop when we reach

// xfa.form.

while (oParentNode != xfa.form)

{

sFQFieldName = GetVerboseFieldName(oParentNode) +

"." + sFQFieldName;

oParentNode = oParentNode.parent;

}

return sFQFieldName;

}

 
 

Dieses Skript dann aufrufen (zB mit Clic-Event auf ein Button). Dabei wird die UNterschrift überprüft:

Code: Alles auswählen

// Unterschrift überprüfen

// Hier wird zuerst das obige Skript ausgferufen GetFQSOMExp()

var digSig = event.target.getField(GetFQSOMExp(Unterschriftsfeld));

if (digSig)

{

var status = digSig.signatureValidate();

var nameunter = digSig.signatureInfo().name;

app.alert(nameunter); //hier wird der name aus der UInterschrift geholt und in einem Fenster angezeigt

if (status != 4)

{

//hier die bedingung, die ausgeführt wird, wenn die unterschrift nicht gültig ist

}
 

viele grüße

f2k

Antworten