The code below stores and shows data that is displayed in a display field based on what the user selects, and it works great, but I'm unsure how to integrate additional content into this framework.
form1.#subform[0].indPaymentOptions::change - (JavaScript, client)
// Switch - test for 'selected' text, if so, display 'display' text
switch (this.boundItem(xfa.event.newText)) {
case "Donation/Contribution":
var display = "Restricted use, typically student fundraisers. May not be to a political entity or support a political purpose. Fundraised donations require a copy of deposit. <span style=\"color: #FF0000; font-style: italic;\">Must be charged to unrestricted funds, and Sr. Officer approval required.</span>";
XmlToShow = XmlStart+display+XmlEnd;
xfa.resolveNode("form1.#subform.Display_Field_Pay_Types").value.exData.loadXML( XmlToShow,true);
taxReportable.rawValue = "Y";
AccountCodesDynamic.rawValue = "001285";
break;
case "Membership":
var display = "University sponsored memberships must be directly related to the proposed member’s University responsibilities. Obtain institutional rather than individual memberships to allow participation by several or alternate employees. Memberships must use a UCSC address for business verification.";
XmlToShow = XmlStart+display+XmlEnd;
xfa.resolveNode("form1.#subform.Display_Field_Pay_Types").value.exData.loadXML( XmlToShow,true);
taxReportable.rawValue = "Y";
AccountCodesDynamic.rawValue = "001200,\n001210";
break;
default:
VendPaymentOptions.rawValue = "Please select an option from the 'Select type' drop-down menu above.";
taxReportable.rawValue = "";
break;
}
I'm trying to show a hidden field once one of the dropdown items is selected using an if/then statement. I've tried putting the code below in with the code above, but that doesn't work. I'm unfamiliar with the event handling scheme of livescript, so I'm also not sure where the if then statement should be input. Should it be put into the *click section? Or the initialze section? If someone could shine some light on what to do here that would be great.
if (xfa.resolveNode("form1.#subform.indPaymentOptions").rawValue == 1) {
xfa.resolveNode("form1.#subform.textfield1").presence = "visible";
}
else {
xfa.resolveNode("form1.#subform.textfield1").presence = "hidden";
}