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
SOLVED

If then multiple conditions, including Next button click

Avatar

Level 4

I just want to use Javascript (action builder has fits over multiple "trigger" conditions).  For previous if/then statements I've just used .rawvalues of radio buttons and checkboxes.  Now, I want the event to happen (navigating to page x) when the next button is clicked AND with a checkbox value of 1.

I know about && to join conditions, I just don't know how to code in a rawvalue for an OK button. 

Is there a clean way to do this?  I don't want to have a dozen Ok buttons occupying the space and becoming visible given a checkbox value. That sounds a bit clunky.  I'd appreciate any help!

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi,

Buttons don't hold values--you can't assign a value to a button.

You normally place a script on it's click event, some solutions for you would be

  • to have either a hidden field or a formVariable) store whether a click has happened.
  • change an attribute of the button (like the fillColor) when clicked and then have other scripts look for that. A button click event changing fillColor does not cause calculate events to fire, so if you want some script on the calculation event to run in response to a fillColor change, put an

               TextField1.execCalculate(); at the end of the script.

Here's an example:

///////////////////////////////////////////////////////////////////////////////

form1.#subform[0].Button1::click - (FormCalc, client)

    $.fillColor = "255,255,255"          //button click changes its own fillColor

    TextField1.execCalculate()          //then fires the script below

/////////////////////////////////////////////////////////////////////////////

form1.#subform[0].TextField1::calculate - (FormCalc, client)

if(Button1.fillColor == "255,255,255")then  //checks button fillColor

     $ = "yes"                                             //does something

else

     $ = "no"                                             //or does something

endif

/////////////////////////////////////////////////////////////////////////////

Hope this helps!

Stephen

View solution in original post

0 Replies

Avatar

Correct answer by
Level 7

Hi,

Buttons don't hold values--you can't assign a value to a button.

You normally place a script on it's click event, some solutions for you would be

  • to have either a hidden field or a formVariable) store whether a click has happened.
  • change an attribute of the button (like the fillColor) when clicked and then have other scripts look for that. A button click event changing fillColor does not cause calculate events to fire, so if you want some script on the calculation event to run in response to a fillColor change, put an

               TextField1.execCalculate(); at the end of the script.

Here's an example:

///////////////////////////////////////////////////////////////////////////////

form1.#subform[0].Button1::click - (FormCalc, client)

    $.fillColor = "255,255,255"          //button click changes its own fillColor

    TextField1.execCalculate()          //then fires the script below

/////////////////////////////////////////////////////////////////////////////

form1.#subform[0].TextField1::calculate - (FormCalc, client)

if(Button1.fillColor == "255,255,255")then  //checks button fillColor

     $ = "yes"                                             //does something

else

     $ = "no"                                             //or does something

endif

/////////////////////////////////////////////////////////////////////////////

Hope this helps!

Stephen

The ultimate experience is back.

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

Register Now