Expand my Community achievements bar.

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

complex: highlight Requried fields PrePrint/PostPrint

Avatar

Level 4
Hi all



I have come across a strange problem - please help!!



On docReady I have a script that set red border on all requried fields in the form. In prePrint event on Form Object another script hides red border on all requried fields



Script to hide border on all fields looks like this:



function highlightRequried_off(){



//loop => all pages in form

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {

//collection: all fields-objects on page

var oFields = xfa.layout.pageContent(nPageCount, "field");



//loop => all objects on page

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

//is field mandatory?

if( oFields.item(i).mandatory == "error"){



//mandatory field => erase mandatory highlight

//hide "requried border"

oFields.item(i).ui.oneOfChild.border.presence = "invisible";

}

}

}

}



The script has been working great, until resently, where I developed some noPrint fields with help texts. These fields are very simple with a PrePrint script that set them invisible and PostPrint to go back visible.



Everything works perfectly until such a noPrint field is inserted in the form!! The prePrint event on FormObject is still executed, but the border is just not set hidden!! Is there limitations with prePrint event on FormObject, when using prePrint/PostPrint on fields aswell??? Seems strange but true



Any help or explanation is much appreciated



/Thomas

Jyske Bank, Denmark
0 Replies