Still cannot figure this out.

Explorer ,
Jul 21, 2020

Copy link to clipboard

Copied

 I have a section with 5 checkbox choices. I need them to start all as required, but once, one of any of the 5 choices is selected, the required and red outline goes away for the other 4 remaining choices please.  I am very confused how to use the .value option for a group of check boxes. I had thought just that alone, would un-red the remailing 4, once any of the others are selected. It should be noted, even though, I want the required red outline to go away, I still want the other 4 boxes to be able to be selected please. 

I am also having a hard time with a simpler one. I have a text box, that if anything is entered, I need a word endered into another text box please. 

Thank you in advance. 

TOPICS
Acrobat SDK and JavaScript, Comment review and collaborate PDF, Create PDFs, General troubleshooting, How to, PDF forms

Views

92

Likes

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

Still cannot figure this out.

Explorer ,
Jul 21, 2020

Copy link to clipboard

Copied

 I have a section with 5 checkbox choices. I need them to start all as required, but once, one of any of the 5 choices is selected, the required and red outline goes away for the other 4 remaining choices please.  I am very confused how to use the .value option for a group of check boxes. I had thought just that alone, would un-red the remailing 4, once any of the others are selected. It should be noted, even though, I want the required red outline to go away, I still want the other 4 boxes to be able to be selected please. 

I am also having a hard time with a simpler one. I have a text box, that if anything is entered, I need a word endered into another text box please. 

Thank you in advance. 

TOPICS
Acrobat SDK and JavaScript, Comment review and collaborate PDF, Create PDFs, General troubleshooting, How to, PDF forms

Views

93

Likes

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
Jul 21, 2020 0
Most Valuable Participant ,
Jul 21, 2020

Copy link to clipboard

Copied

Do all of these check-boxes have the same name (ie, are they a group)?

Likes

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
Reply
Loading...
Jul 21, 2020 1
Explorer ,
Jul 21, 2020

Copy link to clipboard

Copied

I had to change the names to be able to select more than one. 

Likes

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
Reply
Loading...
Jul 21, 2020 0
Explorer ,
Jul 22, 2020

Copy link to clipboard

Copied

This is part of my confusion, if I give them all the same name, then only one is allowed. 

Likes

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
Reply
Loading...
Jul 22, 2020 0
Most Valuable Participant ,
Jul 22, 2020

Copy link to clipboard

Copied

You can use this code as the custom calculation script of a (hidden) text field:

 

var fields = ["Checkbox1", "Checkbox2"]; // enter the actual field names here
var isFilled = false;
for (var i in fields) {
	var f = this.getField(fields[i]);
	if (f.valueAsString!="Off") isFilled = true;
}
for (var i in fields) {
	var f = this.getField(fields[i]);
	f.required = !isFilled;
}

Likes

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
Reply
Loading...
Jul 22, 2020 1
Explorer ,
Jul 22, 2020

Copy link to clipboard

Copied

WOW! That is perfect! Danke so much :). Can you give a suggestion for the other part please? 🙂 

Likes

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
Reply
Loading...
Jul 22, 2020 0
Explorer ,
Jul 22, 2020

Copy link to clipboard

Copied

That code is doing what I needed it to do perfect for a bunch of check-box groups. Thank you! I think, I am just stuck on the one last part and the form and it is going to be done. This should be a simple one, but for some reason, what I think should work, isn't:

I have two text-box options: 
Textbox # 1) Place of Birth, if they were born in the USA. 

Textbox # 2) Place of Birth if they were born in a Foreign Country. 

If they enter any text in textbox # 1, I need a another textbox on the form to auto fill with just: USA. 

If they skip textbox # 1 and enter a Foreign Country in textbox # 2, I need the response to auto fill in the same textbox that textbox # 1 triggered with just USA please. 

I hope that makes sense and thank you in advance. 

Likes

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
Reply
Loading...
Jul 22, 2020 0
Most Valuable Participant ,
Jul 22, 2020

Copy link to clipboard

Copied

Use this:

var v1 = this.getField("Textbox1").valueAsString;

var v2 = this.getField("Textbox2").valueAsString;

event.value = (v1!="") ? "USA" : v2;

Likes

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
Reply
Loading...
Jul 22, 2020 1
Explorer ,
Jul 22, 2020

Copy link to clipboard

Copied

That is perfect!

I just relaized one other thing, if you could help me a little more :). For the two above mentioned textboxes and the check-boxes, in addition, to turning off the required red box(es), how would I disable the other textbox and the checbox(es), from being selected please? 

Sorry to be a PITA. I notice almost all the answers I found via searches, have been answered by you as well. Your like count should be three times what it is :). 

Likes

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
Reply
Loading...
Jul 22, 2020 0
Bob-Dole LATEST
Explorer ,
Jul 22, 2020

Copy link to clipboard

Copied

Figured it out! 

 

Likes

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
Reply
Loading...
Jul 22, 2020 0