Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XML Digital Signature throws NAMESPACE_ERR exception under OpenJDK 11 that works under Java SE 8

3878978Jan 30 2019 — edited Feb 6 2019

My XML Digital Signature code runs fine under Java 8 (1.8.0_161), but on upgrading to OpenJDK 11 (11.0.2, ), it now traps with an NAMESPACE_ERR exception:

org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

at java.xml/com.sun.org.apache.xerces.internal.dom.ElementNSImpl.setName(ElementNSImpl.java:109)

at java.xml/com.sun.org.apache.xerces.internal.dom.ElementNSImpl.<init>(ElementNSImpl.java:84)

at java.xml/com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createElementNS(CoreDocumentImpl.java:2089)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.XmlWriterToTree.writeStartElement(XmlWriterToTree.java:99)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.Marshaller.marshalGenericNode(Marshaller.java:303)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.Marshaller.marshalGenericNode(Marshaller.java:286)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.Marshaller$14.marshalObject(Marshaller.java:251)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.Marshaller$14.marshalObject(Marshaller.java:247)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.XmlWriterToTree.marshalStructure(XmlWriterToTree.java:200)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.DOMXMLObject.marshal(DOMXMLObject.java:180)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.DOMXMLSignature.marshal(DOMXMLSignature.java:233)

at java.xml.crypto/org.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(DOMXMLSignature.java:325)

at com.esignforms.open.crypto.XmlDigitalSignature.sign(XmlDigitalSignature.java:208)

If I revert back to Java 8, it works again. 

I noted that our XML digital signature code makes no direct references to namespaces.  Basic code does set the DocumentBuildFactory to be namespace aware:

  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

  dbf.setNamespaceAware(true);

When we sign under Java 8, this is the resulting digitally signed output for our XML <snapshot> element, which does have a namespace of our own:

<snapshot xmlns="http://open.esignforms.com/XMLSchema/2011" timestamp="2019-01-30T12:40:46-08:00" type="document"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Date Doc 1</title>

<meta name="robots" content="noindex, nofollow" />

<meta name="Description" content="Confidential document" />

<meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="Generator" content="Yozons Open eSignForms document generator version 19.1.19_p0129_1657" />

<meta name="DeploymentId" content="bbfe9bed-918d-446b-9518-8ec303bafb83" />

<meta name="TransactionId" content="5163276c-d8aa-436f-8a96-5bc0c9eca931" />

<meta name="TransactionTemplateId" content="d15a91a3-87b8-457e-84bc-0b56ac7ebb10" />

<meta name="TransactionMode" content="Test" />

<meta name="PackageId" content="60301b59-ca07-429e-bb76-7083bfd6e642" />

<meta name="PackageVersionId" content="61afd6f3-b79e-4d14-844d-3a38541020ea" />

<meta name="PackageVersionPartyName" content="FirstParty" />

<meta name="DocumentId" content="e105af31-4b37-4092-9795-48b7c762ae97" />

<meta name="DocumentName" content="Date Doc 1" />

<meta name="DocumentVersionId" content="52248c28-187e-43f0-8de8-98357fa63654" />

<meta name="DocumentVersionPageId" content="62edfd59-be00-435a-9bd5-583cc84d220a" />

<meta name="DocumentVersionPartyName" content="FirstParty" />

<meta name="DocumentPageMode" content="REVIEW" />

<meta name="HtmlRenderTimestamp" content="2019-01-30 12:40:43.041 PST" />

<meta name="RequestIpAddr" content="50-46-115-249.evrt.wa.frontiernet.net (50.46.115.249)" />

<meta name="RequestUserAgent" content="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15" />

<base href="https://open.esignforms.com/demo/" />

<style type="text/css">

/* platform esf.css */

@import url(//fonts.googleapis.com/css?family=Pacifico);

body.esf { font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 1em; }

.esf a img { border: none; }

.esf table.center, .esf div.center { margin-left: auto; margin-right: auto; }

.esf p.left, .esf span.left, .esf div.left, .esf th.left, .esf td.left { text-align: left; }

.esf p.right, .esf span.right, .esf div.right, .esf th.right, .esf td.right { text-align: right; }

.esf p.center, .esf span.center, .esf th.center, .esf td.center { text-align: center; }

.esf p.justify, .esf span.justify, .esf div.justify { text-align: justify; }

.esf .bottom { vertical-align: bottom; }

.esf .top { vertical-align: top; }

.esf .middle { vertical-align: middle; }

.esf .w5 { width: 5%; }

.esf .w10 { width: 10%; }

.esf .w15 { width: 15%; }

.esf .w20 { width: 20%; }

.esf .w25 { width: 25%; }

.esf .w30 { width: 30%; }

.esf .w33 { width: 33%; }

.esf .w34 { width: 34%; }

.esf .w35 { width: 35%; }

.esf .w40 { width: 40%; }

.esf .w45 { width: 45%; }

.esf .w48 { width: 48%; }

.esf .w50 { width: 50%; }

.esf .w60 { width: 60%; }

.esf .w70 { width: 70%; }

.esf .w75 { width: 75%; }

.esf .w80 { width: 80%; }

.esf .w85 { width: 85%; }

.esf .w90 { width: 90%; }

.esf .w95 { width: 95%; }

.esf .w98 { width: 98%; }

.esf .w100 { width: 100%; }

.esf .boT { border-top: 1px solid black; }

.esf .boB { border-bottom: 1px solid black; }

.esf .boTB { border-top: 1px solid black; border-bottom: 1px solid black; }

.esf .boL { border-left: 1px solid black; }

.esf .boR { border-right: 1px solid black; }

.esf .boLR { border-left: 1px solid black; border-right: 1px solid black; }

.esf .boBdash { border-bottom: 1px dashed black; }

.esf .boBdot { border-bottom: 1px dotted black; }

.esf .boBthick { border-bottom: 4px solid black; }

.esf .box { border: 1px solid black; }

.esf .boxthicker { border: 2px solid black; }

.esf .boxthick { border: 4px solid black; }

.esf .underline { text-decoration: underline; }

.esf .bold { font-weight: bold; }

.esf .italic { font-style: italic; }

.esf ::-webkit-input-placeholder { font-style: italic; }

.esf :-moz-placeholder { font-style: italic; }

.esf ::-moz-placeholder { font-style: italic; }

.esf :-ms-input-placeholder { font-style: italic; }

.esf .caps { text-transform: uppercase; }

.esf .smallcaps { font-variant: small-caps; }

.esf .lowercase { text-transform: lowercase; }

.esf .f6 { font-size: 6pt; }

.esf .f7 { font-size: 7pt; }

.esf .f8 { font-size: 8pt; }

.esf .f9 { font-size: 9pt; }

.esf .f10 { font-size: 10pt; }

.esf .f11 { font-size: 11pt; }

.esf .f12 { font-size: 12pt; }

.esf .f14 { font-size: 14pt; }

.esf .f16 { font-size: 16pt; }

.esf .f18 { font-size: 18pt; }

.esf .f20 { font-size: 20pt; }

.esf .f22 { font-size: 22pt; }

.esf .f24 { font-size: 24pt; }

.esf .f28 { font-size: 28pt; }

.esf .f32 { font-size: 32pt; }

.esf .f36 { font-size: 36pt; }

.esf .f40 { font-size: 40pt; }

.esf .f48 { font-size: 48pt; }

.esf .f60 { font-size: 60pt; }

.esf .f72 { font-size: 72pt; }

.esf .f96 { font-size: 96pt; }

.esf .red {color: red;}

.esf .green {color: green;}

.esf .blue {color: blue;}

.esf .white {color: white;}

.esf .black {color: black;}

.esf .gray  {color: gray;}

.esf .nomargin { margin: 0; }

.esf .nomarginT { margin-top: 0; }

.esf .nomarginB { margin-bottom: 0; }

.esf .nomarginTB { margin-top: 0; margin-bottom: 0; }

.esf .nomarginL { margin-left: 0; }

.esf .nomarginR { margin-right: 0; }

.esf .nomarginLR { margin-left: 0; margin-right: 0; }

.esf .nowrap { white-space: nowrap; }

/* HTML5 versions for table cellpadding="0" through cellpadding="5" */

.esf table.cellpadding0 th, .esf table.cellpadding0 td { padding: 0; }

.esf table.cellpadding1 th, .esf table.cellpadding1 td { padding: 1px; }

.esf table.cellpadding2 th, .esf table.cellpadding2 td { padding: 2px; }

.esf table.cellpadding3 th, .esf table.cellpadding3 td { padding: 3px; }

.esf table.cellpadding4 th, .esf table.cellpadding4 td { padding: 4px; }

.esf table.cellpadding5 th, .esf table.cellpadding5 td { padding: 5px; }

/* HTML5 versions for table cellspacing="0" through cellspacing="5" */

.esf table.cellspacing0 { border-spacing: 0; }

.esf table.cellspacing1 { border-spacing: 1px; }

.esf table.cellspacing2 { border-spacing: 2px; }

.esf table.cellspacing3 { border-spacing: 3px; }

.esf table.cellspacing4 { border-spacing: 4px; }

.esf table.cellspacing5 { border-spacing: 5px; }

/* HTML5 version of border="1" through border="2" */

table.gridBorder { border-top: 1px solid black; border-left: 1px solid black; }

table.gridBorder th, table.gridBorder td { border-bottom: 1px solid black; border-right: 1px solid black; }

table.gridBorder2 { border-top: 2px solid black; border-left: 2px solid black; }

table.gridBorder2 th, table.gridBorder2 td { border-bottom: 2px solid black; border-right: 2px solid black; }

.esf div.newPage { border-top: 1px dotted gray; }

.esf .doNotPrint { } /* do nothing normally, but we override in @print so suppress the element */

.esf div.pagediv { } /* do nothing, but allows you to style as each page is wrapped in a div */

.esf div.inline { display: inline-block; }

.esf span.inlineblock { display: inline-block; }

/* The following are generally not useful for a document, but are used in the auto-rendering of fields, labels, errors, etc. Many of these can be set via DocumentStyles in Open ESF. */

/* For the Field Label rendering */

.esf label.normal { }

.esf label.normal-error { color: red; font-weight: bold; background-color: yellow; }

.esf label.small { font-size: 8pt; }

.esf label.small-error { font-size: 8pt; color: red; font-weight: bold; background-color: yellow; }

.esf span.viewFieldData { width: inherit; } /* when viewing field data -- not in input mode */

.esf span.viewFieldData-error { font-weight: bold; font-style: italic; background-color: pink; border: 2px dashed red; } /* when viewing data that was not known -- not in input mode */

.esf span.labelFieldArea { display: inline-block; } /* sets the width for the label and field area */

.esf span.labelFieldArea span.labelAreaStacked { display: block; white-space: nowrap; }

.esf span.labelFieldArea span.labelAreaRightStacked { display: block; text-align: right; white-space: nowrap; }

.esf span.labelFieldArea span.labelAreaCenterStacked { display: block; text-align: center; white-space: nowrap; }

.esf span.labelFieldArea span.labelArea { display: inline-block; white-space: nowrap; }

.esf span.labelFieldArea span.labelAreaRight { display: inline-block; text-align: right; white-space: nowrap; }

.esf span.labelFieldArea span.labelAreaCenter { display: inline-block; text-align: center; white-space: nowrap; }

.esf span.labelFieldArea span.fieldAreaStacked { display: block; width: 100%; }

.esf span.labelFieldArea span.fieldAreaLeftStacked { display: block; width: 100%; text-align: left; }

.esf span.labelFieldArea span.fieldAreaRightStacked { display: block; width: 100%; text-align: right; }

.esf span.labelFieldArea span.fieldAreaCenterStacked { display: block; width: 100%; text-align: center; }

.esf span.labelFieldArea span.fieldArea { display: inline-block; width: 100%; }

.esf span.labelFieldArea span.fieldAreaLeft { display: inline-block; width: 100%; text-align: left; }

.esf span.labelFieldArea span.fieldAreaRight { display: inline-block; width: 100%; text-align: right; }

.esf span.labelFieldArea span.fieldAreaCenter { display: inline-block; width: 100%; text-align: center; }

.esf span.labelFieldArea span.fieldAreaStackedAuto { display: block; width: auto; }

.esf span.labelFieldArea span.fieldAreaLeftStackedAuto { display: block; width: auto; text-align: left; }

.esf span.labelFieldArea span.fieldAreaRightStackedAuto { display: block; width: auto; text-align: right; }

.esf span.labelFieldArea span.fieldAreaCenterStackedAuto { display: block; width: auto; text-align: center; }

.esf span.labelFieldArea span.fieldAreaAuto { display: inline-block; width: auto; }

.esf span.labelFieldArea span.fieldAreaLeftAuto { display: inline-block; width: auto; text-align: left; }

.esf span.labelFieldArea span.fieldAreaRightAuto { display: inline-block; width: auto; text-align: right; }

.esf span.labelFieldArea span.fieldAreaCenterAuto { display: inline-block; width: auto; text-align: center; }

.esf span.fieldArea { display: inline-block; }

.esf span.fieldAreaLeft { display: inline-block; text-align: left; }

.esf span.fieldAreaRight { display: inline-block; text-align: right; }

.esf span.fieldAreaCenter { display: inline-block; text-align: center; }

.esf span.fieldAreaAuto { display: inline; }

/* Auto widths do not make sense really with alignment as the field should be no bigger than the contents; we'll keep it inline-blocked */

.esf span.fieldAreaLeftAuto { display: inline-block; text-align: left; }

.esf span.fieldAreaRightAuto { display: inline-block; text-align: right; }

.esf span.fieldAreaCenterAuto { display: inline-block; text-align: center; }

/* For signature/initials display */

.esf .signature, .esf .signature input { font-family: 'Pacifico', 'Bradley Hand ITC', 'Lucida Handwriting', 'Comic Sans MS', cursive; font-size: 14pt; color: blue; white-space: nowrap; }

.esf div.signatureBlock { border: 3px solid #9899c4; border-radius: 10px; background-color: #efffff; padding: 0px 3px 3px 12px; width: 720px; page-break-inside: avoid; }

.esf div.signatureBlock p.signatureHeader { font-size: 11pt; font-weight: bold; text-decoration: underline; margin-bottom: 0px; }

.esf .signatureMetadata { font-size: 8pt; font-family: 'Courier New', Courier, monospace; white-space: nowrap; }

/* For optional/required/error input fields; uses span.viewFieldData for showing the data when in non-edit mode */

.esf input.required { background-color: #FFFFE7; font-weight: bold; border: 1px solid #7F9DB9; width: inherit; }

.esf input.optional { background-color: white; font-weight: bold; border: 1px solid #7F9DB9; width: inherit; }

.esf input.error { background-color: #FFC0CB; font-weight: bold; border: 1px solid red; width: inherit; }

.esf select.required { background-color: #FFFFE7; font-weight: bold; border: 1px solid #7F9DB9; width: inherit; }

.esf select.optional { background-color: white; font-weight: bold; border: 1px solid #7F9DB9; width: inherit; }

.esf select.error { background-color: #FFC0CB; font-weight: bold; border: 1px solid red; width: inherit; }

.esf textarea.required { background-color: #FFFFE7; font-weight: bold; border: 1px solid #7F9DB9; width: inherit; }

.esf textarea.optional { background-color: white; font-weight: bold; border: 1px solid #7F9DB9; width: inherit; }

.esf textarea.error { background-color: #FFC0CB; font-weight: bold; border: 1px solid red; width: inherit; }

/* Special override for optional checkboxes to not have a border around them */

.esf input[type="checkbox"].required { border: 0 none !important; outline-color: #FFFFE7; outline-style: solid; outline-width: medium; }

.esf input[type="checkbox"].optional { border: 0 none !important; }

.esf input[type="checkbox"].error { outline: 1px solid red; }

/* Special override for optional radio to not have a border around them */

.esf input[type="radio"].required { border: 0 none !important; outline-color: #FFFFE7; outline-style: solid; outline-width: medium; }

.esf input[type="radio"].optional { border: 0 none !important; }

.esf input[type="radio"].error { outline: 1px solid red; }

.esf input[type="radio"] { margin-bottom: 3px; } /* push it up a bit so fits with label better */

/* For buttons */

.esf p.buttons { margin-top: 2em; margin-left: 2em; }

.esf p.buttons input { margin-right: 2em; font-size: 1.1em; padding: 5px 10px; margin-top: 5px; }

.esf p.buttons input.caution { color: #FF8000; }

.esf p.buttons input.preferredFlow { font-weight: bold; color: green; font-size: 1.3em; padding: 8px 15px; }

.esf p.extraButtons { text-align: right; margin-top: -3em; }

.esf p.extraButtons input { color: blue; font-size: 0.6em; padding: 2px 3px; margin-right: 1em; }

.esf div.documentAndPageNumbersInfo { font-family: 'Courier New', Courier, monospace; font-size: 8pt; text-align: right; color: lightgray; }

/* For image overlays */

.esf div.imageOverlay { position: relative; display: inline-block; }

.esf div.imageOverlay img { margin: 0; padding: 0; }

.esf div.imageOverlay span.imageOverlayFieldArea { position: absolute; margin: 0; padding: 0; }

.esf div.imageOverlay span.imageOverlayFieldArea input[type="radio"] { margin: 0; padding: 0; }

.esf div.imageOverlay span.imageOverlayFieldArea input[type="checkbox"] { margin: 0; padding: 0; }

.esf input.small { font-size: 8pt; }

.esf input.upload { color: green; }

/* For file uploads of images displayed inline */

.esf img.fileUploadInlineImage200 { max-width: 200px; border: 2px solid black; page-break-inside: avoid; }

.esf img.fileUploadInlineImage400 { max-width: 400px; border: 2px solid black; page-break-inside: avoid; }

.esf img.fileUploadInlineImage600 { max-width: 800px; border: 2px solid black; page-break-inside: avoid; }

.esf img.fileUploadInlineImage800 { max-width: 800px; border: 2px solid black; page-break-inside: avoid; }

/* For standard display of ErrorEntry[] arrays from Errors */

.esf table.errorEntryArea { margin-left: 1em; border: 1px solid #FBD777; border-radius: 5px; background-color: #FDE8A5; width: 95%; padding-top: 2px; padding-bottom: 2px; }

.esf ul.errorEntryArea { padding-left: 20px; }

.esf li.error-ErrorEntry { list-style-type: circle; font-size: 1em; font-weight: bold; color: red; margin-left: 0px; margin-right: 1em; }

.esf li.warning-ErrorEntry { list-style-type: circle; font-size: 1em; font-weight: bold; color: blue; margin-left: 0px; margin-right: 1em; }

.esf li.success-ErrorEntry { list-style-type: circle; font-size: 1em; font-weight: bold; color: green; margin-left: 0px; margin-right: 1em; }

.esf li.info-ErrorEntry { list-style-type: circle; font-size: 1em; font-weight: bold; color: black; margin-left: 0px; margin-right: 1em; }

/* Used for multi-line reports to separate them like "greenbar paper" of old */

.esf .bgGreenbarLight { background-color: transparent; }

.esf .bgGreenbarDark { background-color: #E8E6E6; }

.esf span.jspfooter { font-size: 8pt; color: gray; }

.esf div.jspErrorPageMessage { margin-left: 1em; width: 700px; font-weight: bold; background-color: pink; border: 1px solid black; border-radius: 10px; padding: 0px 1em 0px 1em; }

@media print {

  body.esf { margin: 0; padding: 0; font-size: 80% !important; }

  .esf div.newPage { border-top: none; page-break-after: always; }

  .esf a.showURL:link:after, a.showURL:visited:after { content: " (" attr(href) ")"; font-size: 80%; }

  .esf .doNotPrint { display: none; }

}

/* Begin document style id: 9a000404-5f56-4a1c-ad4a-be6382c67d97, version id: 86f339d5-81e2-4117-95c2-8f747f5a6fe3 */

body.esf { font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt;    }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 span.signature { font-family: Pacifico, cursive; font-size: 14pt; color: blue; font-style: normal; font-weight: normal; font-variant: normal; text-transform: inherit;  }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 span.signature input { font-family: Pacifico, cursive; font-size: 14pt; color: blue; font-style: normal; font-weight: normal; font-variant: normal; text-transform: inherit;  }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 span.viewFieldData {      }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 input[type='checkbox'].required { border: 0 none !important; outline-color: #FFFFE7; outline-style: solid; outline-width: medium; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 input[type='radio'].required { border: 0 none !important; outline-color: #FFFFE7; outline-style: solid; outline-width: medium; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 input.required {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: #FFFFE7; border: 1px solid #7F9DB9; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 select.required {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: #FFFFE7; border: 1px solid #7F9DB9; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 textarea.required {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: #FFFFE7; border: 1px solid #7F9DB9; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 input.optional {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: white; border: 1px solid #7F9DB9; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 select.optional {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: white; border: 1px solid #7F9DB9; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 textarea.optional {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: white; border: 1px solid #7F9DB9; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 input[type='checkbox'].error { border: 0 none !important; outline: 1px solid red; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 input[type='radio'].error { border: 0 none !important; outline: 1px solid red; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 input.error {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: #FFC0CB; border: 1px solid red; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 select.error {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: #FFC0CB; border: 1px solid red; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 textarea.error {    font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: #FFC0CB; border: 1px solid red; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 label.normal {      }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 label.normal-error {   color: red; font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: yellow; }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 label.small {  font-size: 8pt;    }

.esf .X86f339d5_81e2_4117_95c2_8f747f5a6fe3 label.small-error {  font-size: 8pt; color: red; font-style: normal; font-weight: bold; font-variant: normal; text-transform: inherit; background-color: yellow; }

/* End document style */

</style>

<script type="text/javascript">

(function() {

  // If not defined yet, ensure our top "JavaScript namespace" variable 'esf' is created.

  if ( typeof esf == "undefined" ) {

  esf = {

  version: {

  major: 19, minor: 1, update: '19',

  toString: function(){

  with(esf.version){

  return major + "." + minor + "." + update;

  }

  }

  },

  appname: 'Open eSignForms',

  htmlCopyright: '&copy; 2019 Yozons, Inc.',

  textCopyright: 'Copyright (c) 2009-2019 Yozons, Inc.'

  };

  esf.getRelease = function() {

  return this.appname + " " + this.version.toString();

  };

  if ( typeof console != "undefined") console.log(esf.getRelease() + ' - ' + esf.textCopyright);

  esf.saveScrollPosition = function(elem) {

  var currLeft = window.pageXOffset || document.documentElement.scrollLeft;

  var currTop  = window.pageYOffset || document.documentElement.scrollTop;

  elem.form.ESF_PAGE_SCROLLLEFT.value = currLeft;  // form field name must match DocumentPageBean.HIDDEN_PAGE_SCROLLLEFT

  elem.form.ESF_PAGE_SCROLLTOP.value  = currTop;   // form field name must match DocumentPageBean.HIDDEN_PAGE_SCROLLTOP

  }

  esf.autoPost = function(inputField) {

  esf.confirmOnPageUnloadMessage = null; // do not block leaving page for autopost

  esf.hideAllSubmitInputFields();

  inputField.form.ESF_AUTO_POST_FIELD_ID.value = inputField.id; // form field name must match DocumentPageBean.HIDDEN_AUTO_POST_FIELD_ID

  esf.saveScrollPosition(inputField);

  inputField.form.submit();

  };

  esf.blockEnterKeyViaInputFields = function(e) {

  var evt = e || window.event;

  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

  if ((evt.keyCode == 13) && (node.type=="text")) {

  return false;

  }

  };

  esf.checkConfirmOnPageUnload = function(confirm,durationMsec) {

  if (! confirm) {

  window.onbeforeunload = null;

  }

  if ( durationMsec && durationMsec > 0 )

  esf.hideAllSubmitInputFieldsTemporarily(durationMsec);

  else

  esf.hideAllSubmitInputFields();

  };

  // For links, we don't hide buttons and we don't clear the unload unless requested AND the target is _top or _self (or no target set)

  esf.checkLinkConfirmOnPageUnload = function(confirm,atag) {

  if (! confirm && (atag.target == "_top" || atag.target == "_self" || atag.target == "") ) {

  window.onbeforeunload = null;

  }

  };

  // Default is no message to display on page unload

  esf.confirmOnPageUnloadMessage = null;

  esf.confirmOnPageUnload = function(e) {

  e = e || window.event;

          if ( esf.confirmOnPageUnloadMessage ) {

          if (e) {

          e.returnValue = esf.confirmOnPageUnloadMessage;

          }

              return esf.confirmOnPageUnloadMessage;

          }

  };

  esf.hideAllSubmitInputFields = function() {

    if ( document.getElementsByTagName ) {

    var inputFields = document.getElementsByTagName("input");

    for( var i=0; i < inputFields.length; ++i ) {

      if ( inputFields[i].type == "submit" )

          esf.makeInvisible(inputFields[i]);

    }

    var buttonFields = document.getElementsByTagName("button");

    for( var i=0; i < buttonFields.length; ++i ) {

    esf.makeInvisible(buttonFields[i]);

    }

    return true;

    }

  };

  esf.showAllSubmitInputFields = function() {

    if ( document.getElementsByTagName ) {

      var inputFields = document.getElementsByTagName("input");

    for( var i=0; i < inputFields.length; ++i ) {

      if ( inputFields[i].type == "submit" )

          esf.makeVisible(inputFields[i]);

    }

    var buttonFields = document.getElementsByTagName("button");

    for( var i=0; i < buttonFields.length; ++i ) {

    esf.makeVisible(buttonFields[i]);

    }

    return true;

    }

  };

  esf.hideAllSubmitInputFieldsTemporarily = function(durationMsec) {

  esf.hideAllSubmitInputFields();

  setTimeout( esf.showAllSubmitInputFields, durationMsec );

  };

  esf.displayById = function(id) {

  if ( document.getElementById && document.getElementById(id) )

  esf.display(document.getElementById(id));

  };

  esf.display = function(elem) {

  if ( elem && elem.style )

  elem.style.display = "block";

  };

  esf.hideById = function(id) {

  if ( document.getElementById && document.getElementById(id) )

  esf.hide(document.getElementById(id));

  };

  esf.hide = function(elem) {

  if ( elem && elem.style )

  elem.style.display = "none";

  };

  esf.makeVisibleById = function(id) {

  if ( document.getElementById && document.getElementById(id) )

  esf.makeVisible(document.getElementById(id));

  };

  esf.makeVisible = function(elem) {

    if ( elem && elem.style )

    elem.style.visibility = 'visible';

  };

  esf.makeInvisibleById = function(id) {

  if ( document.getElementById && document.getElementById(id) )

  esf.makeInvisible(document.getElementById(id));

  };

  esf.makeInvisible = function(elem) {

    if ( elem && elem.style )

    elem.style.visibility = 'hidden';

  };

  esf.makeTemporarilyInvisible = function(elem, durationMsec) {

  esf.makeInvisible(elem);

      setTimeout( function(){esf.makeVisible(elem);}, durationMsec );

  };

  esf.ensureTopWindow = function() {

    if (window != window.top)

  top.location.href = location.href;

  };

  esf.getElementsByFieldName = function(fieldName) {

    if ( document.getElementsByName ) {

    return document.getElementsByName(fieldName.toLowerCase()); // Field names are all lowercase in the HTML DOM

    }

    return []; // not really an empty node list, but an empty array so it has a 'length' property to query before accessing

  };

  esf.getElementByFieldName = function(fieldName) {

    var elemNL = esf.getElementsByFieldName(fieldName);

    return elemNL.length > 0 ? elemNL[0] : null;

  };

  esf.setAllCheckboxesByName = function(name,b) {

    var checkboxes = esf.getElementsByFieldName(name);

    for( var i=0; i < checkboxes.length; ++i ) {

      if ( checkboxes[i].type == "checkbox" )

          checkboxes[i].checked = b;

    }

  };

  esf.checkAllCheckboxesByName = function(name) {

      esf.setAllCheckboxesByName(name,true);

  };

  esf.uncheckAllCheckboxesByName = function(name) {

      esf.setAllCheckboxesByName(name,false);

  };

  /* Expects two radiobuttons to be laid out as [] Yes  [] No order -- can also be stacked as long as Yes is first */

  esf.setupDisplayIfYesNoRadioButtonGroupIsYes = function(yesNoRadioButtonGroupName,elemIdToShowIfYes,currentRadioButtonGroupFieldValue) {

    var rbYesNoElems = document.getElementsByName(yesNoRadioButtonGroupName.toLowerCase());

    if ( rbYesNoElems && rbYesNoElems.length == 2 ) { /* radio buttons will only exist in EDIT mode */

    rbYesNoElems[0].onclick = function() { esf.displayById(elemIdToShowIfYes); }; /* yes rb */

    rbYesNoElems[1].onclick = function() { esf.hideById(elemIdToShowIfYes); }; /* no rb */

    }

    var lowerValue = currentRadioButtonGroupFieldValue.toLowerCase();

    if ( lowerValue.startsWith('y') || lowerValue.startsWith('t') || lowerValue == '1' )

        esf.displayById(elemIdToShowIfYes);

    else

        esf.hideById(elemIdToShowIfYes);

  };

  /* Expects two radiobuttons to be laid out as [] Yes  [] No order -- can also be stacked as long as Yes is first */

  esf.setupDisplayIfYesNoRadioButtonGroupIsNo = function(yesNoRadioButtonGroupName,elemIdToShowIfNo,currentRadioButtonGroupFieldValue) {

        var rbYesNoElems = document.getElementsByName(yesNoRadioButtonGroupName.toLowerCase());

Comments
Post Details
Added on Jan 30 2019
3 comments
1,086 views