I was able to get the script to work, however only if I remove some of the other functionality in the object. I am hoping to get the form's required objects color coded [blue if incomplete, green if complete].
The page object is "infoDoctor", the subform is "nameDoctor", and the object is "nameFirstDoctor". The object has a custom appearance; Borders are solid, white, corners rounded; Background fill is solid, white. Hard to explain all of this clearly. I can email you the PDF if it is easier.
Here is the script that I'm using...
enter event:
if (this.rawValue == "First Name") // Default text in object.
{
xfa.resolveNode("nameDoctor.nameFirstDoctor.ui.#textEdit.border.fill.color").value = "153,204,226"; // Turn the object blue.
border.edge.presence = "hidden"; // Hide the border.
this.rawValue = "";
}
exit event:
if (this.rawValue == null) // Nothing entered.
{
xfa.resolveNode("nameDoctor.nameFirstDoctor.ui.#textEdit.border.fill.color").value = "153,204,226"; // Keep the object blue.
border.edge.presence = "hidden"; // Hide the border.
this.rawValue = "First Name";
}
else // Valid entry.
{
xfa.resolveNode("nameDoctor.nameFirstDoctor.ui.#textEdit.border.fill.color").value = "102,188,90"; // Turn the object green.
border.edge.presence = "hidden"; // Hide the border.
}
For some reason this does not work.
Also, I am having trouble removing the object's fillable area background color in the prePrint event. This is what I want to happen when printing:
If the object is filled in by the user, I want the color to disappear and the text to remain. If the object is not filled in and still has the default text, I want the color and text to disappear.
Post print, I want the color and text to return to the previous values.
This is the script that I used...
prePrint event:
if (this.rawValue == "First Name")
{
xfa.resolveNode("nameDoctor.nameFirstDoctor.ui.#textEdit.border.fill.color").value = "255,255,255";
border.edge.presence = "hidden";
this.rawValue = "";
}
else
{
xfa.resolveNode("nameDoctor.nameFirstDoctor.ui.#textEdit.border.fill.color").value = "255,255,255";
border.edge.presence = "hidden";
}
PostPrint event:
if (this.rawValue == "")
{
xfa.resolveNode("nameDoctor.nameFirstDoctor.ui.#textEdit.border.fill.color").value = "153,204,226";
border.edge.presence = "hidden";
this.rawValue = "First Name";
}
else
{
xfa.resolveNode("nameDoctor.nameFirstDoctor.ui.#textEdit.border.fill.color").value = "102,188,90";
border.edge.presence = "hidden";
}
Woo! Long post! Sorry if it is too much. I'm just stressed and excited and delirious. Your help is greatly appreciated!