I have several forms I'm trying to build and use dropdown fields in. The forms work great up to a point, they store the user selected values when entered and saved, when reopened the form dropdown shows the saved value. I am trying to use code to fire after the form opens and use the saved and visible dropdown value which loaded into the field via a function or with code.
I'm trying to read the saved value after it reopens and have tried unsuccessfully to use a lot of event. I find it hard to believe the value is not available
//doesn't retrieve any value if called from field events initialize, calculate, validate, postopen, docready, ready:form
var myrawValue = this.rawValue
var myValue = this.value
xfa.host.messageBox(myrawValue + " --> " +myValue ,"Show DropDown Values", 2, 2);
function fShowSign()
//Called from the field Change Event
{
//called from the field change event works great!
//doesn't retrieve any value if called from field events initialize, calculate, validate, postopen, docready, ready:form
var oldValue = LP.Pg1.Pg1Ft.cboSigner.boundItem(xfa.event.prevText);
var newValue = LP.Pg1.Pg1Ft.cboSigner.boundItem(xfa.event.newText);
// For DEBUGGING purposes
xfa.host.messageBox(oldValue + " --> " +newValue ,"fShowSign", 2, 2);
// show the appropriate subform
switch (newValue) {
case "2":
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign1").presence= "visible";
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign2").presence= "visible";
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign3").presence= "hidden";
break;
default:
// hide all
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign1").presence= "hidden";
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign2").presence= "hidden";
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign3").presence= "hidden";
break;
}
}
function fSignLoad()
{
//doesn't retrieve any value if called from field events initialize, calculate, validate, postopen, docready, ready:form
var myValue = LP.Pg1.Pg1Ft.cboSigner.boundItem(xfa.event.change);
// For DEBUGGING purposes
xfa.host.messageBox(myValue + " --> " +myValue ,"fSignLoad", 2, 2);
// show the appropriate subform
switch (myValue) {
case "2":
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign1").presence= "visible";
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign2").presence= "visible";
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign3").presence= "hidden";
break;
default:
// hide all
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign1").presence= "hidden";
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign2").presence= "hidden";
xfa.resolveNode("LP.Pg1.Pg1Ft.sfrmSign3").presence= "hidden";
break;
}
}