• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Multiple Radio Button Selection Check

New Here ,
Jul 03, 2024 Jul 03, 2024

Copy link to clipboard

Copied

I have the following form and code working as I would like but would like to know how to improve the code for a more involved form.  The code checks to see that the radio buttons have a selection and then unhides the signature block and hides the signature button for the respective column.  The more involved form will have 4 columns and at least 10 radio buttons for each column.  The listed code is set to a Mouse Enter trigger of the Engineering Signoff button.

 

Jason38411853lq8c_0-1720034675275.png

 

var EN1 = this.getField("EN1").value;
var EN2 = this.getField("EN2").value;
var EN3 = this.getField("EN3").value;

if ((EN1=="Off") || (EN2=="Off") || (EN3=="Off")) {
    this.getField("ENSig").display = display.hidden
    this.getField("ENChk").display = display.visible
}
else {
    this.getField("ENSig").display = display.visible
    this.getField("ENChk").display = display.hidden
}

 

 

TOPICS
JavaScript , PDF forms

Views

173

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Jul 03, 2024 Jul 03, 2024

Wouldn't you want the signature blocks hidden until all selections have been made instead of triggering the visibility with a Mouse Enter action?  In my opinion, if the user puts the mouse over the field and it disappears it will seem like there is something wrong with the form.  Back to your question, if you continue with the radio button naming convention, you could run a loop to set the visibility like this:

 

this.getField("ENSign").display = display.visible;
this.getField("ENChk").display = di

...

Votes

Translate

Translate
Enthusiast ,
Jul 03, 2024 Jul 03, 2024

Copy link to clipboard

Copied

Wouldn't you want the signature blocks hidden until all selections have been made instead of triggering the visibility with a Mouse Enter action?  In my opinion, if the user puts the mouse over the field and it disappears it will seem like there is something wrong with the form.  Back to your question, if you continue with the radio button naming convention, you could run a loop to set the visibility like this:

 

this.getField("ENSign").display = display.visible;
this.getField("ENChk").display = display.hidden;

for(var i=1;i < 11; i++)
{
if(this.getField("EN"+i).value=="Off")
{
this.getField("ENSign").display = display.hidden;
this.getField("ENChk").display = display.visible;
break;
}
}

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 03, 2024 Jul 03, 2024

Copy link to clipboard

Copied

Sorry, the screenshot above is in Prepare Form mode.  The signature block is hidden when the form is open.  

At first your code didn't work and I thought I was doing something wrong, but then I realized you had "ENSign" instead of "ENSig"  🙂   I fixed that and it is working as intended, thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 03, 2024 Jul 03, 2024

Copy link to clipboard

Copied

LATEST

🙂 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines