Expand my Community achievements bar.

Function bug on exit event

Avatar

Former Community Member
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 of 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 with the function argument?
0 Replies