Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Checkboxes control appearance of numeric fields when two or more checkboxes are checked

Avatar

Level 2
Dear friends

I have a problem including checkboxes, numeric fields and variables



Task:

There are five checkboxes to be checked by the user (let's name them 1,2,3,4,5)

Combined with the checkboxes there are 5 numericFields and 1 Textbox (let's name them A,B,C,D,E and T)

The following has to be scripted!

If two or more checkboxes are checked the textbox (T) plus the corresponding numericField (1-A; 2-B; 3-C; 4-D; 5-E) has to appear

If only one checkbox (or no checkbox) has been checked - none of the numericFields or the Textbox is supposed to be visible.



Idea:

I tried to introduce a variable connected to the form:ready event of the first checkbox:



Formular1.superframe.general.primarylevel::ready:form - (FormCalc, client)

var schooleducationlevelcounter=0



I set the Textbox and the five numericfields to invisible then on the exit event of each of the five checkboxes - I tried to increment the variable and have the script check whether or not the variable has become greater than 1 - if that was the case the script is supposed to set the correwsponding numericField to visible:

This script looks like this (it is probably ridiculously wrong - however I am supernew to Javascripting...)

(By the way is the rawValue of a checked checkbox "1" - and of an unchecked checkbox "0" ?!?!?)



Formular1.superframe.general.primarylevel::exit - (JavaScript, client)

if (xfa.form.Formular1.superframe.general.primarylevel.rawValue==1)

{

++schooleducationlevelcounter

}

if (schooleducationlevelcounter>1)

{

xfa.form.Formular1.superframe.administrator.totalcompschoolform.presence = "visible"

}



I hope you can help me out...
0 Replies

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now