Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Conditional Text field from Check Box

Avatar

Level 2

It seems impossible that this hasn't been addressed before at some point, but for the life of me I couldn't find an answer:

I am working in Live Cycle Designer 7.0 on a PC.

I need to create a Text Field which is hidden UNLESS a Radio Button is clicked.

I've tried this in JavaScript but can't get the Text Field to toggle between "visible" or "hidden" if the condition of the Radio button changes.

The TextField in question is named "TextField2" and the Radio Button is named "RadioButtonList"

I am, by the way, by anyone's definition, a complete newbie using JavaScript. So anything I can just copy/paste will be a real gift.

Thanks!

Steve

3 Replies

Avatar

Level 6

This is FormCalc on the Click event:

if($.rawValue==1)then
TextField2.presence="visible"
else TextField2.presence="hidden"
endif

This goes on the radio button not the Object named RadioButtonList

Set the textfield's presence  as hidden (exclude from layout) via the Object palette/Field tab

Avatar

Level 2

Nope.

First, I had trouble figuring how to apply the Form Calc to the Button, as opposed to the Button List.

I actually had to edit the first line in the Script Editor, which seems pretty lame.

That is to say, I just don't see how to get to the radio button, not the Object named RadioButtonList

BUT, I can't UNCHECK the field once it's been checked. That is, if I click "on" the Radio Button, it won't revert to unchecked if I try to click it "off".

In other words, if the person unchecks the Radio button due to some error, I need it to click off and the TextFiled to go back to being hidden.

Like I said, this can't be that hard, or maybe I'm just missing what you're trying to explain. Any other ideas?

Steve

Avatar

Level 2

I might have answered my own question...with your help.

It seems that what I really needed was to attach your Form Calc to a CHECK box, not a radio button.

Everything seems to work just fine in this configuration.