Skip to main content
evap47850311
Participating Frequently
November 27, 2020
Question

Evaluating Multiple Sets of Radio Buttons With JavaScript

  • November 27, 2020
  • 1 reply
  • 906 views

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 has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 27, 2020

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.

evap47850311
Participating Frequently
November 27, 2020

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

No didn't get any errors

try67
Community Expert
Community Expert
November 27, 2020

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.