Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Calling a function to perform multiple actions

Avatar

Level 4

Hello.

I can't call this function to save my life and would appreciate any help.

Background

I have an exclusion group of 8 radio buttons. I have some follow-up radio  buttos that are visible only if a certain radio button is selected (rawValue 1).

However, I want to set the follow up radio buttons to null when I click on any other radio button value (rawValue 2-7).  So considering there are 10 follow-up radio buttons, I don't want to have that much code in the click event of each initial radio button.

Goal

I'm trying to make a script object function that sets all the follow-up radio button values to null. I would then ideally call this function on the click event of the other initial radio buttons.

What I Tried

//script on the form1 script object called "Refresh"

function refreshvalues() {

followup1.rawValue = null;

followup2.rawValue = null;

followup3.rawValue = null;

followup4.rawValue = null;

......//and so on

}

//script on the click event of each other initial radio button

form1.variables.Refresh.refreshvalues();

// I've tried putting different things in the ()s to no avail. 

1 Accepted Solution

Avatar

Correct answer by
Level 4

Solution:

When referencing form objects from a script object function, you have to use the absolute reference. I thought I could use Control-click since the script lies on the root node; that was incorrect. Control-Shift-Click brought the correct reference.

function a(form1)

{

xfa.resolveNode("form1.Page1.....

}

As you can see, not having form1 disabled the entire function.

View solution in original post

2 Replies

Avatar

Level 4

Ok let me refine/simplify my question.

I can call the function if the target objects are in a named subform...but if they have to be looked up the function will not work.

For reference, here's the actual function script:

function a(form1)

{

xfa.resolveNode("Page1.Page1.#subform.flowedsubform.contacts.brokeragename").rawValue = null;

}

I assume I need to use something different than "form1".  Any ideas?

Avatar

Correct answer by
Level 4

Solution:

When referencing form objects from a script object function, you have to use the absolute reference. I thought I could use Control-click since the script lies on the root node; that was incorrect. Control-Shift-Click brought the correct reference.

function a(form1)

{

xfa.resolveNode("form1.Page1.....

}

As you can see, not having form1 disabled the entire function.