I have an interactive form where the user applies for a leave of absence and selects one of 6 reasons.
Maternity
Medical
Worker's Comp
Family
Military
Personal
If the user selects Family, there are two sub-reasons:
Serious Illness
Child-related
I've made these two a radio button group and the top-level reasons a separate radio button group. Is there any way to nest one group inside another? I found this .xdp code at http://eslifeline.wordpress.com/2008/05/24/creating-nested-radio-buttons/
form1.#subform[0].Continents.Africa::change - (JavaScript, client)
var asia = xfa.resolveNode("form1.#subform[0].Continents.Asia");
var africa = xfa.resolveNode("form1.#subform[0].Continents.Africa");
var europe = xfa.resolveNode("form1.#subform[0].Continents.Europe");
var kenya = xfa.resolveNode("form1.#subform[0].Continents.Kenya");
var egypt = xfa.resolveNode("form1.#subform[0].Continents.Egypt");
var india = xfa.resolveNode("form1.#subform[0].Continents.India");
var china = xfa.resolveNode("form1.#subform[0].Continents.China");
var other = xfa.resolveNode("form1.#subform[0].Continents.Other");
var explain = xfa.resolveNode("form1.#subform[0].Explain");
asia.y = 89+"points";
europe.y = 119+"points";
other.y = 149+"points";
//asia.x = "1.25in";
//africa.x = "1.25in";
//europe.x = xPosition.value;
kenya.x = childXPosition.value;
egypt.x = childXPosition.value;
kenya.presence = "visible";
egypt.presence = "visible";
kenya.y = 45+"points"
egypt.y = 60+"points";
india.presence = "hidden";
china.presence = "hidden";
explain.presence = "hidden";
I modifed it for my form, like this
**************************hide Child and Illness until Family is clicked
**********doesn't work
var Family= xfa.resolveNode("LOA.Form1.Reason.Family");
var Child = xfa.resolveNode("LOA.Form1.Reason.Child");
var Illness = xfa.resolveNode("LOA.Form1.Reason.Illness");
Child.presence = "hidden";
Illness.presence = "hidden";
Family.y = 0.25+"inches";
Child.y = 0.625+"inches";
Illness.y = 0.625+"inches";
Child.x = childXPosition.value;
Illness.x = childXPosition.value;
Child.y = 5.25+"inches"
Illness.y = 5.0+"inches";
LOA.Form1.Reason.Family::ready:form - (JavaScript, client)
Utilities.resetPositions();
I would greatly appreciate any help or suggestions in making this code function.
Solved! Go to Solution.
Views
Replies
Total Likes
Views
Replies
Total Likes
I don't think that nesting them is the answer. If they are all under the same RadioButton group then you can only have one selection. How about if we create two groups and the second group contains the Serioous Illness and Chilr Related selctions. Then we could hide this group and only make it visible if the Family selection is made. Here is an example to show what I mean.
Paul
What a great idea! That's really cool! I like the dropdown list instead of all the radio buttons. And the script is very concise.Thank you, Paul. I appreciate your help very much! Do you use Livecycle ES2? I'm interested in Action Builder.
Views
Replies
Total Likes
Yes I use LCES2 and I am familiar with Action Builder.
Paul
Views
Replies
Total Likes
Looking at your file, I can't see the subform or the text. Why? How does your file work?
Views
Replies
Total Likes
In the hierarchy view if you click on the FamilySubform object (this is the subform that holds the radiobutton group and the text) then click on the Object palette. Near the bottom of that palette is the presence property......I have it set fro hidden exclude from layout. If you change it to visible you will see it in the Design. I put it that way beacuse that is what I want for the default.
Paul
Views
Replies
Total Likes
Right. I see how that works. OK. Thank you again. I'm emailing with Adobe right now to see if I can get an upgrade to Livecycle ES2. I want to try out Action Builder.
Views
Replies
Total Likes
I see that you have the radio buttons in FamilySubform. I've been using Radio Button Groups. How does a SubForm work?
Views
Replies
Total Likes
You can also download a trial version from the web site if you wish.
Paul
Views
Replies
Total Likes
Right. I did that last night at home. Huge download. 3GB! Here at work, we have Adobe Volume Licensing, and I'm wondering if I could just download an upgrade to ES2. Maybe I have to get a new PO and purchase it. That's what I'm trying to find out.
Views
Replies
Total Likes
Subforms are basically containers that help group objects together. The advantage is that I can change properties on the container and everything inside it gets that attribute. So in your case if I change the presence of the container then the text, the radiobutton group and the individual radiobuttons all get their presence changed as well. I do it with one statement instaed of 2 or more.
Paul
Views
Replies
Total Likes
OK. I'm following your idea. I'm experimenting with the dropdown list, using these list items:
Maternity (attach doctor's certification*) - complete sections #3 and #4
Medical/Disability (attach doctor's certification*)
Worker's Compensation Disability (attach doctor's certification*)
Family Leave: (complete section #4)
Military Leave (attach copy of orders)
Personal Leave (duration of leave may not exceed 8 weeks)
Under the Binding tab, these have the values 1-6. So I edited your script to this.
if (xfa.event.rawData == 4){
FamilySubform.presence = "visible"
} else {
FamilySubform.presence = "hidden"
}
But it doesn't work. The problem must be (xfa.event.rawData == 4). There's probably another term for rawData when you use a number. What would that look like?
Views
Replies
Total Likes
Sorr, I guessed wrong. The line should be (xfa.event.rawValue == 4), but that doesn't work, either.
Views
Replies
Total Likes
Where did you get xfa.event.rawdata from ......the command xfa.event.newText is used to give you the last the the user selected from the object. The value of the DDList is not committed to the rawValue property until you leave the field so if it was any other event we would use this.rawValue to get what the use selected.
Make sense?
Paul
Views
Replies
Total Likes
That helps. I changed the Values on the Binding tab to words, instead of numbers, and used your script like this:
LOA.Form1.ReasonDropDownList::change - (JavaScript, client)
if (xfa.event.newText == "Family"){
FamilySubform.presence = "visible"
} else {
FamilySubform.presence = "hidden"
}
Your script is this:
form1.#subform[0].DropDownList1::change - (JavaScript, client)
if (xfa.event.newText == "Family"){
FamilySubform.presence = "visible"
} else {
FamilySubform.presence = "hidden"
}
The only difference I can see is the first line.
Is there a way in this line if (xfa.event.newText == "Family"){
to say "LIKE" or "CONTAINS"? So that if the Text is actually longer, like "Family Leave: (complete section #4)," the script will work?
Views
Replies
Total Likes
Not really. the rawValue was from a script I found on another Adobe forum discussion yesterday. I'm going to try to get your script to work for me.
LOA.Form1.ReasonDropDownList::change - (JavaScript, client)
if (xfa.event.newText == "Family"){
FamilySubform.presence = "visible"
} else {
FamilySubform.presence = "hidden"
}
Views
Replies
Total Likes
Its not SQL its a comparison in Java script ....you are controlling what is in the dropdown and what is being set in teh DDList so why not simply compare to the real value that you set (even if it is multiple words).
Paul
Views
Replies
Total Likes
OK. Just to keep things simple until I get this working, I'm using "Family." How can I attach my PDF so that you can see what's wrong?
Views
Replies
Total Likes
Email it to LiveCycle8@gmail.com
Paul
Views
Replies
Total Likes