Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Change Events - Show/Hide Subforms

Avatar

Level 1

I am relatively new to LiveCycle. A couple of questions:

1) I can readily show and hide subforms based on a radio button list selection (one click). When I use the same (or similar) script in conjunction with a drop down box, I need to make the same selection twice before the proper subform appears (and the "improper" subform disappears). The script, under change events, looks like this:

if(this.rawValue ==1) then

WaiverSubform.presence= "invisible";

ChangeSubform.presence= "visible";

elseif(this.rawValue ==2) then

WaiverSubform.presence= "visible";

ChangeSubform.presence= "invisible";

endif

As mentioned, it works w/ one click of a radio button but drop down list selections have to be made twice. Any help?

2) Also under the change events, I am attempting to reset the same subforms if a form filler has entered data then has a change of mind, backs up, and makes an alternate selection which causes the subform to be invisible and brings up an alternate subform. What ends up happening is the entire form is reset (at least I am not getting the error messages). I am setting variables and using the xfa.host.resetData script. Any help on this one would be appreciated as well.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Larry,

1) Try moving the script to the drop-down exit event.

2) xfa.host.ResetData effects the entire form. You will have to reset each individual rawValue to achieve your objective.

Steve

View solution in original post

5 Replies

Avatar

Correct answer by
Former Community Member

Larry,

1) Try moving the script to the drop-down exit event.

2) xfa.host.ResetData effects the entire form. You will have to reset each individual rawValue to achieve your objective.

Steve

Avatar

Level 1

Steve,

1) Moving the script to the drop-down exit event did the trick. Thank you.

2) With regard to the resetting of subform data, I am trying to mimic the script shown on "SubformResetValues.pdf" found on the Adobe LiveCycle Developer site (http://www.adobe.com/devnet/livecycle/designer_scripting_samples.html). Instead of linking the script to the "clear" button (as shown in the sample), I am including it under the change event of the choice object that drives the appearance (or disappearance) of the subform. As mentioned, I am new to this but will keep trying. What would the script look like for resetting each individual rawValue?

Thanks again,

Larry B

Avatar

Former Community Member

I'm sorry. My mistake. I did not know you could pass parameters to the xfa.host.resetData() to effect specific subforms. Nice.

Values can be reset by setting the rawValue to "", for example,

form1.page1.subform1.firstName.rawValue = "";

In other cases the default may a specific value. For example, if a radio button is supposed to be on by default and the 'on' value is 1, you would set the rawValue to "1".

Avatar

Former Community Member

Hi guys i need some help, i have a some subForms that i want to manipulate with a dropdown list, and i've tried to do this with this code in the exit event,

if(this.rawValue ==1) {

xfa.resolveNode("form1.theForm.subForm1").presence= "invisible";

xfa.resolveNode("form1.theForm.subForm2").presence= "visible";
}

else if(this.rawValue ==2){

xfa.resolveNode("form1.theForm.subForm3").presence= "visible";

xfa.resolveNode("form1.theForm.subForm4").presence= "invisible";

}

This is not working. The subforms are not working. I think that here if(this.rawValue ==1), the number, is the position of the list that i inserted in the drop down list object. Am i correct?

If someone can help i would apreciate.

I am also attaching the file.

Thanks.

Regards

Mancini.

Avatar

Former Community Member

The value that is being reported in the dropdown is the value that is shown on the screen. If you add an app.alert(this.rawValue) before the if statement you will see what is being returned. When I modified your code to look for "one" it worked fine.

paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----