How do I write an if statement that when true, runs two actions?
if (NumericField1.rawValue > 0)
{
xfa.resolveNode("#pageSet.Page1.Image1").presence = "visible" + Rectangle1.presence = "visible";
}
Well, the problem is you're trying to control objects on the body page and a masterpage at once.
This is generally not so simple to accomplish.
I changed your form a bit.
The paperclip image and the numeric field now monitor the valur of the numeric field and change the wanted property if the value is larger than 0.
Script for the paperclip (wrapped in a subform)
form1.Page.#subform[0].NumericField1::ready:layout - (JavaScript, client)
this.ui.numericEdit.border.fill.color.value = this.rawValue > 0 ? "255,255,153" : "255,255,255";
Script for the numeric field
form1.#pageSet[0].Page1.Clip::ready:layout - (JavaScript, client)
this.presence = xfa.resolveNode("Page.#subform.NumericField1").rawValue > 0 ? "visible" : "hidden";
Script for the remove button
form1.Page.#subform[0].Button3::click - (JavaScript, client)
var myDoc = event.target;
var sFile = ListBox1.getDisplayItem(ListBox1.selectedIndex);
try {
if (sFile !== "") {
var nResponse = xfa.host.messageBox("You are about to delete the highlighted attachment. \n\nDo you want to continue?", "Deleting an Attachment", 1, 2);
if (nResponse == 4) {
myDoc.removeDataObject(sFile) + ListBox1.deleteItem(ListBox1.selectedIndex) + (NumericField1.rawValue = NumericField1.rawValue - 1);
}
} else {
xfa.host.messageBox("No document selected.");
}
} catch (e) {
xfa.host.messageBox("Error in removing document");
}
radzmar:
Now that I see the correct answer I know I never would have figured this out. Your form works great! This is why I was trying to close the pane that contains the paperclip so users would only use this interface. Thank you so much for all your help with this. I really appreciate your time and sharing your expertise.
Have a great day!
-Don
North America
Europe, Middle East and Africa
Asia Pacific