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

How do I change an objects value type depending on a Y/N Radio button?

Avatar

Level 2

I have the following code behind some Radio Buttons:

 

Form1645.Page3.TeeCrossSubform.TeeCross::exit - (JavaScript, client)

if Page3.TeeCrossSubform.TeeCross.rawValue = "N" {

    xfa.Page3.TeeCrossSubform.Disruptfield.access = "open";

    xfa.Page3.TeeCrossSubform.TeeCrossCC.access = "protected";

    }

else {

    xfa.Page3.TeeCrossSubform.Disruptfield.access = "protected";

    xfa.Page3.TeeCrossSubform.TeeCrossCC.access = "open";

    }

 

NOTE: I based this code on the following information (which may be wrong but I found nothing else on the subject): http://forms.stefcameron.com/2010/03/08/disabling-all-fields-within-subform/

No matter which radio button is selected (Y or N) the fields are all "open" or "unprotected".

Any help is greatly appreciated!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

sorry my fault, the SOM expression still maybe wrong.

Try

Form1645.Page3.TeeCrossSubform.TeeCross::click - (JavaScript, client)

if (xfa.form.Form1645.Page3.TeeCrossSubform.TeeCross.rawValue == "1") {


xfa.form.Form1645.Page3.TeeCrossSubform.Disruptfield.access = "open";

xfa.form.Form1645.Page3.TeeCrossSubform.TeeCrossCC.access = "protected";

} else {


xfa.form.Form1645.Page3.TeeCrossSubform.Disruptfield.access = "protected";

xfa.form.Form1645.Page3.TeeCrossSubform.TeeCrossCC.access = "open";

}

View solution in original post

5 Replies

Avatar

Level 10

Hi,

I think you SOM expression is not correct.

xfa.Page3.TeeCrossSubform.... should be xfa..Form1645.Page3.TeeCrossSubform...

Avatar

Level 2

I have update the code to be the following but it still doesn't work:

Form1645.Page3.TeeCrossSubform.TeeCross::exit - (JavaScript, client)

if xfa.Page3.TeeCrossSubform.TeeCross.rawValue = "N" {

    xfa.Form1645.Page3.TeeCrossSubform.Disruptfield.access = "open";

    xfa.Form1645.Page3.TeeCrossSubform.TeeCrossCC.access = "protected";

    }

else {

    xfa.Form1645.Page3.TeeCrossSubform.Disruptfield.access = "protected";

    xfa.Form1645.Page3.TeeCrossSubform.TeeCrossCC.access = "open";

    }

Any other ideas?

Avatar

Correct answer by
Level 10

Hi,

sorry my fault, the SOM expression still maybe wrong.

Try

Form1645.Page3.TeeCrossSubform.TeeCross::click - (JavaScript, client)

if (xfa.form.Form1645.Page3.TeeCrossSubform.TeeCross.rawValue == "1") {


xfa.form.Form1645.Page3.TeeCrossSubform.Disruptfield.access = "open";

xfa.form.Form1645.Page3.TeeCrossSubform.TeeCrossCC.access = "protected";

} else {


xfa.form.Form1645.Page3.TeeCrossSubform.Disruptfield.access = "protected";

xfa.form.Form1645.Page3.TeeCrossSubform.TeeCrossCC.access = "open";

}

Avatar

Level 2

Thank you radzmar!  Based on your code I determined the issue I did incorrectly is I didn't use the '==' in the if statement and I missed the () brackets at the beginning and end of the logic statement.  It has been over 10 years since I took my Java course in school so I am forgetting the little things like this!

Avatar

Level 2

Hi again radzmar!

What if i want to restrict user from using the arrow keys within radio button??

I have 3 options in on radio group where the 2nd and 3rd options are protected. Ofcourse tab order does not work there but when the focus is on the first option, i am still able to move to the next options (2nd and 3rd) with arrow keys and they get selected despite them being "protected".

This happens only when i use arrow key and now while using mouse!

Please help!

Thanks,

Radhika Magaji