Skip to main content
evap47850311
Participating Frequently
Nov 27, 2020 9:54 AM UTC
Question

Evaluating Multiple Sets of Radio Buttons With JavaScript

I have a form with 3 yes/no questions. I am using radio buttons (a, b, c).  I need to trigger an event -- make a hidden text box visible -- only if the answer is 'yes' to all three questions.

I have this code but it doesn't work. Not sure what's wrong. Please help

event.target.hidden = !( (this.getField("a").value=="aYes") && (this.getField("b").value=="bYes") && (this.getField("c").value=="cYes"))

This topic is closed to new replies. Start a new post to keep the conversation going.

7 replies

try67
Community Expert
Community Expert
Nov 27, 2020 10:29 AM UTC

Where did you place this code? Are there any error messages in the JS Console when you use it?

You should not use the hidden property. It's deprecated. Use the display property, instead.

Translate
evap47850311
Participating Frequently
Nov 27, 2020 10:57 AM UTC

I placed it in the custom calculation script of the hidden field

No didn't get any errors

Translate
try67
Community Expert
Community Expert
Nov 27, 2020 11:01 AM UTC

Can you share the actual file with us?

You can attach it to the original message using the tiny paperclip icon at the bottom when you edit it, or upload it to a file-sharing website (like Dropbox, Google Drive, Adobe Cloud, etc.), generate a share link and then post it here.

Translate