Remove all signatures from a form with javascript - InfoPath Dev
in

InfoPath Dev

Remove all signatures from a form with javascript

Last post 10-20-2006 02:13 PM by Eric. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-20-2006 01:46 PM

    • Eric
    • Not Ranked
    • Joined on 10-10-2006
    • Posts 24

    Remove all signatures from a form with javascript

    Hello,

    I need to remove all signatures from a form when it moves from one view state to a "rework" view state.

    this is my code fragment so far (doesn't work!) based on other posts I found in the forums.

    function dooButton::OnClick(eventObj)
    {
    var oSignedDataBlocks = XDocument.SignedDataBlocks;
    var count = oSignedDataBlocks.Count;
    if( count <= 0 )
    {
    return;
    }
    XDocument.UI.Alert( oSignedDataBlocks.Count + " signature blocks." );

    var i = 0;
    for( var i = 0; i < count; i++ )
    {
    var oSignedDataBlock = oSignedDataBlocks.Item( i );
    if( oSignedDataBlock != null )
    {
    if( oSignedDataBlock.Signatures != null )
    {
    if( oSignedDataBlock.Signatures[0] != null )
    {
    var oSignatureNode = oSignedDataBlock.Signatures[0].SignatureBlockXmlNode;
    if( oSignatureNode != null )
    {
    oSignatureNode.parentNode.removeChild( oSignatureNode );
    }
    }
    }
    }
    }
    }

  • 10-20-2006 02:13 PM In reply to

    • Eric
    • Not Ranked
    • Joined on 10-10-2006
    • Posts 24

    Re: Remove all signatures from a form with javascript

    I got this code snippet to work but it actually removes the signature block completely from the code as opposed to just unsigning it. I will have to look further.

    function dooButton::OnClick(eventObj)
    {
    ____var oSignedDataBlocks = XDocument.SignedDataBlocks;
    ____var count = oSignedDataBlocks.Count;
    ____if( count <= 0 )
    ____{
    ________return;
    ____}
    ____XDocument.UI.Alert( oSignedDataBlocks.Count + " signature blocks." );
    ____
    ____var i = 0;
    ____for( var i = 0; i < count; i++ )
    ____{
    ________var oSignedDataBlock = oSignedDataBlocks.Item( i );
    ________if( oSignedDataBlock != null )
    ________{
    ____________if( oSignedDataBlock.Signatures != null )
    ____________{
    ________________var oSignatures = oSignedDataBlock.Signatures;
    ________________var count2 = oSignatures.Count;
    ________________XDocument.UI.Alert( count2 + " signatures in signature block " + i + " of " + count );
    ________________for( var j = 0; j < count2; j++ )
    ________________{
    ____________________var signatureNodeRef = oSignedDataBlock.Signatures.Item( j );
    ____________________var oSignatureNode = signatureNodeRef.SignatureBlockXmlNode;
    ____________________if( oSignatureNode != null )
    ____________________{
    ________________________oSignatureNode.parentNode.removeChild( oSignatureNode );
    ____________________}
    ________________}
    ____________}
    ________}
    ____}
    }
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.