Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

49:xfa:... oOriginalNode is null

Avatar

Level 2

When dynamically adding a row to a table using Javascript  I get the following error message...

oOriginalNode is null

49:XFA:form1[0]:validationState

(repeated around 5 times)

This error comes from code that Adobe adds to the top of my code.    It seems to be around removing tooltips.    Seems to be a bug.    Is there a way to officially report this to Adobe?

Good news for me is that the code blows past this and keeps running - whew!

5 Replies

Avatar

Level 10

Hi,

you're using a script in the validate event of form1 which fails at line 49.

There it uses a variable oOriginalNode which is null.

The question now is only why.

Can you please post your script?

Avatar

Level 2

First, thanks for the reply!    The quick answer is that I turned off the option "Color Failed Fields" in Form Properties and the offending 'mandatory' Adobe code was removed and the problem went away.    I still contend that this is an Adobe bug.    (I've found a few others that only appear while running in Acrobat Pro - but luckily don't occur in reader so I can deploy.   I can submit those if there is an audience.)

Here's the bug.

Hmmm, I played with validation, had to turn it off and write my own.    (I was doing some more complex logical tests.)    I'm sure there are some fields left with it turned on by mistake.   

In the hierarchy view, this is the code that shows up,    Line 49 in this code is where this  blows up, i.e., directly in the Adobe 'DO NOT EDIT' function  'DoColorFields'.    The offending line is:

     var oOriginalAssist = oOriginalNode.assist;

Turns out that oOriginalNode is null in cases where dynamically adding a row to a table.. triggered by ...Row.instanceManager.addInstance();

Here is the code in my form, starting from the top:

form1.#variables[0].ColorFieldsValidation - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:99770C66-A4C2-4247-967A-B79CA57A480C CRC:1731464314)

//+ Type: ColorFields

//+ MandatoryBorderColor: 16737843

//+ MandatoryBackColor: 16764057

//+ FailedBorderColor: 255

//+ FailedBackColor: 8421631

//+ Color: failed

function InitializeColorFields() {

          // Disable Acrobat's field highlighting. The Color

          // Failed Fields action takes care of highlighting fields.

          if (xfa.host.name == "Acrobat") {

                    app.runtimeHighlight = false;

          }

}

function DoColorFields(oInvalidNode) {

          // If this form is running on a client other than Acrobat

          // (like on the server) then don't run this script

          if (xfa.host.name != "Acrobat") {

                    return;

          }

          var sClassName = oInvalidNode.className;

          // Only color nodes that are <field>s or <exclGroup>s

          // Ignore everything else

          if ((sClassName != "field") &&

              (sClassName != "exclGroup")) {

                    return;

          }

          // If the node is a <field> that is a button or a barcode, then don't

          // do any color processing

          if (sClassName == "field") {

                    var sUIClassName = oInvalidNode.ui.oneOfChild.className;

                    if ((sUIClassName == "barcode") ||

                        (sUIClassName == "button")) {

                              return;

                    }

          }

          if (oInvalidNode.errorText == "") {

                    // Validation Succeeded

                    // Revert the appearance to its original state

                    var oBorder = sClassName == "field" ? oInvalidNode.ui.oneOfChild.border : oInvalidNode.border;

                    oBorder.parent.nodes.remove(oBorder);

                    // Remove the tool tip if it wasn’t originally specified

                    var sSOM = oInvalidNode.somExpression;

                    sSOM = sSOM.replace("xfa[0].form[0]", "xfa[0].template[0]");

                    var oOriginalNode = xfa.resolveNode(sSOM);

                    var oOriginalAssist = oOriginalNode.assist;

                    if (!oOriginalAssist.isPropertySpecified("toolTip")) {

                              var oToolTip = oInvalidNode.assist.toolTip;

                              oInvalidNode.assist.nodes.remove(oToolTip);

                    }

          }

          else {

                    // Validation Failed

                    // Show the invalid appearance

                    var oFailedBorder = sClassName == "field" ? oInvalidNode.ui.oneOfChild.border : oInvalidNode.border;

                    // Border color

                    // Show a solid border with square corners

                    var sBorderColor = "255, 0, 0";

                    oFailedBorder.presence = "visible";

                    for (var i = 0; i < 4; i++) {

                              var oEdge = oFailedBorder.getElement("edge", i);

                              oEdge.presence = "visible";

                              oEdge.color.value = sBorderColor;

                              oEdge.thickness = "2pt";

                              oEdge.stroke = "solid";

                              var oCorner = oFailedBorder.getElement("corner", i);

                              oCorner.presence = "visible";

                              oCorner.color.value = sBorderColor;

                              oCorner.thickness = "2pt";

                              oCorner.stroke = "solid";

                              oCorner.join = "square";

                              oCorner.inverted = "0";

                              oCorner.radius = "0mm";

                    }

                    // Background color

                    // Show a solid fill color

                    oFailedBorder.fill.color.value = "255, 128, 128";

                    // The presence of the border must be visible to show the fill.

                    // Hide the edges when the invalid appearance doesn't include

                    // changing the border color

                    if (oFailedBorder.presence != "visible") {

                              oFailedBorder.presence = "visible";

                              oFailedBorder.edge.presence = "invisible";

                    }

                    // Replace the current fill type with a solid fill

                    if (oFailedBorder.fill.oneOfChild.className != "solid") {

                              var oFailedFillType = oFailedBorder.fill.oneOfChild;

                              oFailedBorder.fill.nodes.remove(oFailedFillType);

                              var oSolid = xfa.form.createNode("solid", "");

                              oFailedBorder.fill.nodes.append(oSolid);

                    }

                    // Tool Tip

                    // If a tool tip isn't specified, populate the tool tip

                    // with the validation message

                    var oAssist = oInvalidNode.assist;

                    if (!oAssist.isPropertySpecified("toolTip")) {

                              var oFailedToolTip = xfa.form.createNode("toolTip");

                              oAssist.nodes.append(oFailedToolTip);

                              oAssist.toolTip.value = oInvalidNode.errorText;

                    }

          }

}

//-

form1.#variables[0].cLookFeel - (JavaScript, client)

var bEnglish = true;

// This is my code that follows .......

Avatar

Level 10

That you don't see an error in Reader is correct, as this script is only executed in Acrobat.

I think the problem is that the SOM expression for the variable sSOM is changed from form[0] to template[0].

As the template is static you'll always see an exeption with repeating objects as those may not exist in the template.

Comment out this code:

sSOM = sSOM.replace("xfa[0].form[0]", "xfa[0].template[0]");

Avatar

Level 2

Thank you. Question – how do I know if code will only execute in Acrobat? I have some other crufty bugs that only appear in debug mode (i.e., Acrobat) and not in Reader – needless to say these are scary as one never knows if this may change w/ versions/whatever.

(One bug is that checkboxes will not respond to a subsequent click – you must click another checkbox before the previous one can be clicked again. The caveat is that I’m running code on ‘click’ to show/hide other elements. I haven’t isolated this to whether it only happens inside a table or not. And of course, it works for now in Reader, just not Acrobat.)

Thanks again!

Avatar

Level 2

Thank you, both, for this!  It took me a white to figure out where to find the code for the automatically added "DoColorFields".  I finally looked in the right spot under the heirarchy tab and noticed it.  Once I commented out that line the same problem I was having went away.

Thanks again!