These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Hidden Subform to show when checkbox is checked

dbrooks
Registered: Sep 6 2007
Posts: 33

I have a work schedule form that allows staff to plug in their hours. Most work the same hours each week so they need only fill in the time they come in and when they leave. For those whose schedule may differ for a week, I have a box that can be checked: Check if schedule differs from above. If this box is checked, I'd like a subform that I've created to appear (become visible) so this can be filled in. If the box isn't checked, I want the subform to remain hidden. What is the FormCalc script I should use to accomplish this? I've tried:

if (CheckBox1 ne 0) then
AltSchedule.presence = "visible"
else
AltSchedule.presence = "invisible"
endif

This doesn't work and I'm assuming "0" won't work (my thought was that "1" means the box is on and "0" means it is off). Anyway, any help would be appreciated!

Donna

My Product Information:
LiveCycle Designer, Windows
beachbumbali11
Registered: Mar 5 2008
Posts: 74
um i dont know what the formcalc script would be but its pretty easy with a java script you just need to be sure that the check box is contained in a parent index or at least thats the way i got it to work and make sure to put that underscore before the subform name
under change java script it looks like this
if ( yourCheckbox.rawValue == 1)
{_yourSubform.setInstances (1);}
else
{_yourSubform.setInstances (0);}
for th check box make sure in binding tab 1 is on 0 is off
thats all i think
beachbumbali11
Registered: Mar 5 2008
Posts: 74
oops i didnt read too well sorry the above code will work better i think for what your trying to accomplish but it doesnt answer what you asked instance will actually generate the item when clicked not just hide and show, alos i forgot to make the above work check that the subform has a min occurence of 1
What you asked for was this sorry me no read so good tonight
if (yourCheckbox.rawValue == 1)
{yourSubform.presence = "visible";}
elseif (yourCheckbox.rawValue == 0)
{yuorSubform.presence = "invisible";}
however i find that this comand is not so stable but
that should be enough info to get you going you will have to play with the hieracry and bindings and visiblility properties to get either of these scripts to function
hope this helps
dbrooks
Registered: Sep 6 2007
Posts: 33
Thanks; but this did not work for me. I think I'm close with the FormCalc because the subform doesn't show on preview; but if you click on the check box, it still doesn't show.
Formfingers
Registered: Feb 7 2007
Posts: 90
dbrooks - I have set up a form similar to what you're creating (where a user clicks a box/field and a continuation page becomes visible). You'll need to edit the obvious named "Continuation Sheet", but this should work. Also, language is javascript, set to the mouseUp event:


if (event.target.value =1) {
form1.ContinuationSheet.presence = "visible"
}
else {
form1.ContinuationSheet.presence = "invisible"
}


Hope this works for you - good luck!
dbrooks
Registered: Sep 6 2007
Posts: 33
Thanks, Formfingers! I have tried what you suggested and the subform was invisible, but did not become visible after clicking the checkbox. Does my subform need to be a part of my checkbox in the hierarchy? I'm thinking I'm close and I'm just missing one little thing.

Donna
Formfingers
Registered: Feb 7 2007
Posts: 90
Donna - Ensure that your field names are correct in both your script and hierarchy (that's usually where my holdups lie). If they are....

Here's further breakdown of how my form looks:

My hidden subform is actually on it's own separate page (it is called ContinuationSheet). So, in another subform above, when a user clicks the text field that is scripted with the example I posted earlier, only then will the hidden subform appear. In my hierarchy, my subform is NOT wrapped in another; it is on its own, and the presence is "Hidden (Exclude from layout)".

I'm thinking your holdup lies within how your subforms are laid out. Again, I have one subform for the scripted text field and another subform that is hidden (my ContinuationSheet).

If you still need further help...post again or feel free to email me.