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

RadioButton decides content of TextField

Avatar

Level 3

Hi!

I have this RadioButton that depending on what you choose , the text to display in a TexField, like this:

yes.jpg

yes02.jpg

I Tried something like, but is not working:

//by this being the CheckBox

if (this.rawValue == "yes") {

        form1.Subform2.TextField01.access = "readOnly" ;

        form1.Subform2.TextField01.rawValue = "you choose yes" ;

     //Subform2 is the name of the page where is the textfield, the radio and the textfield are in different pages

            }

    else if (this.rawValue == "no") {

        form1.Subform2.TextField01.access = "readOnly" ;

       form1.Subform2.TextField01.rawValue = "you choose no" ;

       

    } else {

     form1.Subform2.TextField01.access = "open" ;

     // if you neither yes nor no, the textfield is editable and you can fill it with anything you want

}

Any ideas?

1 Accepted Solution

Avatar

Correct answer by
Level 5

Maybe your script is wrong. Normaly Radiobuttons have the default  1, 2, .. not yes or no.

I think it's the same in your pdf.

You have to do the following:

  1. mark in the hierarchy the radiobuttonlist
  2. go to "object" | "binding" and take a look there
  3. then you to have to use the following script (You can't ask for "yes" or "no". "Yes" or "no" is the caption not the value.

//you choose yes

if(this.rawValue == 1)

{

    Textfeld1.access = "readOnly";

    Textfeld1.rawValue = "you choose YES";

//you choose another, in a radiobuttonlist with two options is this this no

}else

{

    Textfeld1.access = "readOnly";

    Textfeld1.rawValue = "you choose NO";

}

radiobuttonlist.jpg

That's all. If nobody click yes or no, the textfield is open. You don't need to script this.

I hope I could help?

Kind regards Mandy

View solution in original post

3 Replies

Avatar

Correct answer by
Level 5

Maybe your script is wrong. Normaly Radiobuttons have the default  1, 2, .. not yes or no.

I think it's the same in your pdf.

You have to do the following:

  1. mark in the hierarchy the radiobuttonlist
  2. go to "object" | "binding" and take a look there
  3. then you to have to use the following script (You can't ask for "yes" or "no". "Yes" or "no" is the caption not the value.

//you choose yes

if(this.rawValue == 1)

{

    Textfeld1.access = "readOnly";

    Textfeld1.rawValue = "you choose YES";

//you choose another, in a radiobuttonlist with two options is this this no

}else

{

    Textfeld1.access = "readOnly";

    Textfeld1.rawValue = "you choose NO";

}

radiobuttonlist.jpg

That's all. If nobody click yes or no, the textfield is open. You don't need to script this.

I hope I could help?

Kind regards Mandy

Avatar

Level 3

thanks! I reviewed my code and there was some typos, I fixed them and now it works!