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

make multiple text boxes required if check box ticked

New Here ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

I am using this script

this.getField("cust Tel No").required = !event.target.isBoxChecked(0);

and it works but when i try and add extra text boxes it doesnt, where am i going wrong

this.getField("cust Tel No").required = !event.target.isBoxChecked(0); &&

this.getField("cust Tel Ar").required = !event.target.isBoxChecked(0);

TOPICS
Acrobat SDK and JavaScript

Views

568

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

Community Expert , Apr 16, 2019 Apr 16, 2019

Drop the "&&" at the end of the first line.

Votes

Translate

Translate
Community Expert ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

Drop the "&&" at the end of the first line.

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 ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

Hi thanks,

I have 3 radio buttons, when i use the same script on the second radio button it doesn't work, any reason why and on the third radio button i don't want the text boxes to be required so how do i cancel the required?

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
Community Expert ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

Please describe how you want this to work, exactly.

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 ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

I have 3 radio buttons and 4 text field that need to be completed if either the first or second radio button is checked. If the 3rd radio button is checked then i dont want these text boxes to be required. The radio buttons are choice 1, choice2 and choice 3, choice 3 being the button canceling the text boxes being required

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
Community Expert ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

What's the name of the radio-button group?

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
Community Expert ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

Also, what should happen if no radio button in the group is selected at all?

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 ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

the radio group is required, there has to be one of the radios checked

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
Community Expert ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

I didn't follow what you meant, and the fact the field is required doesn't mean it will always have a selected value, which you have to take into consideration when writing the script.

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 ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

I want to put at the end of the form a script that will ensure all required fields are completed before the form can be signed, however I am not there yet so am leaving that for another day

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
Community Expert ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

Well, you can use this code as the custom calculation script of a (hidden) text field to achieve it:

var v = this.getField("Group19").valueAsString;

var b = (v=="Choice 1" || v=="Choice 2");

this.getField("cust Tel No").required = b;

this.getField("cust Tel Ar").required = b; // etc.

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 ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

LATEST

fantastic 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
New Here ,
Apr 16, 2019 Apr 16, 2019

Copy link to clipboard

Copied

its called Group19, but i just figured out to change the 0 to 1 for the second button so now i just need to know how to cancel the text box being required

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