I am trying to create some code (Javascript) to say if the Contact # is Null then make the 2 fields below mandatory. This code works, the only problem is that it does not put up the Standard message "First name: cannot be left Blank that I would get if I just did this in the Designer tool itself.
When I run the form, I make sure that the Contact # is empty and then I make sure either the First Name (Favor) or Last Name (Fanam) is empty. Based on which one is empty it should say "????" cannot be left blank. If both are empty then it can just put up the message for the first one. If I click around enough on the form then eventually it appears, but not right away. I have this code in a Button Click. Does anyone know of a way I can get the standard message to appear right away if the Contact # is null? If I do this in the designer tool itself (i.e., not scripting) then it works, but I need to do this via scripting because it has to evaluate if Contact # is null first.
var lv_contactno = xfa.resolveNode("xfa.form.data.MainSubform.Contact02Subform.CNTCTNODR PDWN2").rawValue; if (lv_contactno !=null) {
xfa.resolveNode("data.MainSubform.Contact02Subform.FAVOR").mandatory = "error";
xfa.resolveNode("data.MainSubform.Contact02Subform.FANAM").mandatory = "error";
}