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.

Fill text field with checkbox choice

Avatar

Level 3

I don't think I can do this, but is there a way to fill a text box with a checkbox choice?  So I have 10 checkboxes that are connected only in the sense that in the click field I have the other checkboxes.rawValue=0;

The business wants me to pre-fill the text field with the value that is selected in these checkboxes.CPAPPES.jpg

Ideas?

We made them checkboxes, because the business also wanted to be able to uncheck the box if they decide they don't want the coverage.

9 Replies

Avatar

Level 10

you have two ways of doing this.. depending on how your checkbox was created

you can use

TextField14.rawValue = CheckBox14.caption.value.text.value;

OR

TextField14.rawValue = CheckBox14.caption.value.exData.value;

Avatar

Level 1

set the on values of each checkbox to reflect those captions, then

put one of these in each checkbox under click

if (LimitOption1.rawValue != 0 )

{

    CoverageLimit.addItem(LimitOption1.rawValue);

}

else if (LimitOption1.rawValue == 0)

{

    CoverageLimit.deleteItem(LimitOption1.rawValue);

}

Avatar

Level 3

DO I have to group the checkboxes in some way?  So it will choose which one has the correct answer?

Avatar

Level 1

add some of these in the if statement

LimitOption2.rawValue = "0"

LimitOption3.rawValue = "0"

or make them radio buttons and group them

Avatar

Level 10

if you can only choose one checkbox, why don't you make it a radiobutton list with checkbox interface instead of doing changing the value of all checkboxes to 0

Avatar

Level 1

the radio button doesn't leave you the option of choosing nothing after you've clicked on one though.

" because the business also wanted to be able to uncheck the box if they decide they don't want the coverage"

Avatar

Level 10

you can uncheck a radio button if you do it.... if you leave a radiobutton list like so it wont uncheck by itself

Avatar

Level 1

can you elaborate please on how you can leave the option to chose nothing after a user originally clicks on radio button then changes their mind?

Avatar

Level 10

doesnt matter how many radiobuttons you have... you need 3 methods in a script object

As simple as this... you could be able to do it in only the click event but it's always easier using scriptObjects.