condensed edit: what event can I use when a user reopens a form to return the shown/hidden subforms state they left off at? (docReady, form:ready, and layourt:ready did not work)
if (this.rawValue == "1") {
mySubform.presence = "visible";
}
else {
MySubform.presence = "hidden";
}
Or is this the wrong approach? Seems this is the same as setting and reading a variable? :(
original post:
I thought I had this figured out but . . . I have a really long form with many hidden subforms that are revealed with radio buttons. It's just a series of "Do you need this?" with radio buttons for "Yes", "No", "I am not sure".
If they select "I am not sure", another subforms opens and may either have an explanation or another set of questions. Some subforms are nested 4 and 5 deep.
The user needs to be able to open the form, work on it, then reopen and continue. One great answer here pointed me in the right direction but I have stumbled again.
I am using docReady event to set initial states, but maybe that is wrong? And I use docReady to check what the user selected when they reopen the form. Is form:ready more appropriate and is my code approach sound?
Here is a sample of my flawed code:
TopmostSubform.Page1.haveGuestrooms.havePMS::docReady - (JavaScript, client)
this.presence = "hidden";
if (this.rawValue == "1") {
pmsInterface.presence = "visible";
}
else {
havePMS.presence = "hidden";
havePMS.RadioButtonList.rawValue = "";
havePMS.pmsInterface.presence = "hidden";
havePMS.pmsInterface.RadioButtonList.rawValue = "";
havePMS.pmsInterface.connector.presence = "hidden";
havePMS.pmsInterface.connector.rawValue = "";//this is a drop-down list
}
Then the actual code that allows them to change values is on the change event as such:
TopmostSubform.Page1.haveGuestrooms.havePMS.RadioButtonList::change - (JavaScript, client)
if (this.rawValue == "1") {
pmsInterface.presence = "visible";
}
else {
havePMS.pmsInterface.presence = "hidden";
havePMS.pmsInterface.RadioButtonList.rawValue = "";
havePMS.pmsInterface.connector.presence = "hidden";
havePMS.pmsInterface.connector.rawValue = "";//drop-down list
}
The change event code works great, but when I open the form in Acrobat 9 and save with "Extend Features in Adobe Reader . . .". Then go open it (on another machine without LCD ES, the data is saved, but the last state of shown subforms is not. So a question that revealed a hidden subform and then that subform had a value checked will still hold those values but it will be hidden again when closed and reopened. It needs to stay visible to the user so they can continue filling out the form at a later time.
Any insight would be greatly appreciated to my approach. Thank you.
could it be as simple as under document properties > Defaults and select "Automatically" for Preserve scripting changes?and setting the "hidden" subforms as hidden via their Presence in the Object palette rather than on the docReady event
if this sounds whacked, please let me know. thanks
seems to "remember" the user selections as to what was shown by their selections.