These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Function argument in Livecycle

alpha1980
Registered: Mar 2 2007
Posts: 18

In Livecycle Designer, I have the following javascript on the exit event of a text field:

 feedback.datavalid(this);
It calls the following function that checks if there is a valid value contained in the field and if not, highlights the field in red.

   var alpha = /^[a-zA-Z\s]+$/;
 
    function datavalid (ofield) {
    var check = alpha.exec(xfa.resolveNode("ofield").rawValue);
    if ((ofield.rawValue == null) || (ofield.rawValue == "") || (check == null)) {
        ofield.ui.oneOfChild.border.fill.color.value = "255,0,0";
    } else {
        ofield.ui.oneOfChild.border.fill.color.value = "255,255,255";
        }
    }
    xfa.layout.relayout();

However, the debugger returns the following:

   TypeError: xfa.resolveNode("ofield")
 
    has no properties 4:Doc:Init

If I replace xfa.resolveNode("ofield") with xfa.resolveNode("TextField"), the script works fine. But why doesn't it work when passed the function argument?

Hope you can help.

DanB
Registered: May 8 2007
Posts: 34
Just a guess. Maybe the exit event fires after 'this' is no longer in scope. Maybe you should try the Change event.

Dan Barbaria
www.it-prints.com
alpha1980
Registered: Mar 2 2007
Posts: 18
Thanks Dan.

I don't think that is the problem though.

The "this" argument is passed five times in the script and only fails once in this line:

var check = alpha.exec(xfa.resolveNode("ofield").rawValue);
I tried the change event and it is the same.