Check for visible AND empty field

jessicas8725420

30-06-2016

I am creating an application in Livecycle that has sections conditionally switching between 'hidden' and 'visible' as well as a large number of radio buttons and textfields that need to be filled out. I am currently trying to write a script for the preSave event that will check if the fields are empty and visible when the applicant tries to save the document. If any fields are visible and empty a dialog box will list the problem and the empty fields will be highlighted in red. Can anyone please help me with this? I've looked through the forums and have found answers to similar problems but when I try them out them, they do not work. Any suggestions are 110% appreciated!

Accepted Solutions (0)

Answers (2)

Answers (2)

jessicas8725420

05-07-2016

Magus069,

I really appreciate you taking the time to respond and compose such a code! However, I am new to Livecycle and fairly new to coding, so I don't fully understand functions. I was hoping there might be a simpler method that someone with little coding experience might be able to grasp. I'll continue to read through your code to try and understand but to give you an idea of how basic my skills are, here's the code I've been working with:

if((this.resolveNode("Page1.RB.Yes").rawValue==null && this.resolveNode("Page1.RB.No").rawValue == null || this.resolveNode("Page1.TextField1")==null)){

  xfa.host.messageBox("Please answer the highlighted fields", "Form Incomplete",1);

}

if(this.resolveNode("Page1.RB.No").rawValue==null) {

  RB.No.border.edge.color.value="255,0,0";

}

else {

  RB.No.border.edge.color.value="255,255,255";

}

if(this.resolveNode("Page1.RB.Yes").rawValue==null) {

  RB.Yes.border.edge.color.value="255,0,0";

}

else {

  RB.Yes.border.edge.color.value="255,255,255";

}

if(this.resolveNode("Page1.TextField1").rawValue==null) {

  TextField1.border.edge.color.value="255,0,0";

}

else {

  TextField1.border.edge.color.value="255,255,255";

}

This method has been giving me trouble when I try to check if an object is null and visible. Once I add those conditions it will stop working. Thank you so much for your help!

Magus069

MVP

04-07-2016

Hi there,

There is a discussion I've opened to provide people good scripts for any PDF forms. The PDF provided in this thread have a good script to look throughout the form for empty and visible fields.

Have a look, let me know if you have any questions

Validation / Reset Functions, easy to manipulate and to change Forms!!!!

Hope it will help!