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

Cell dropdown in relation to another cell

Community Beginner ,
Feb 26, 2024 Feb 26, 2024

This is a 2 part question:

1. I have 2 drop downs next to each other, "In" and "Out". If one of them is selected, I need the other one not to work and vice versa. How do you accomplish this?

2. The 2 drop downs in question above, "In" and "Out", if it is "In" I need another cell to be black positive number. If the "out" is selected, I need the cell to be a red negitive number. How do you accomplish this?

 

Thanks for anyones help.......

TOPICS
Create PDFs , Edit and convert PDFs , PDF forms
823
Translate
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 ,
Feb 26, 2024 Feb 26, 2024

1. You can set the field to read only depending on condition, with a script, to help you further would need to know dropdown choices and which condition is to set them to read-only.

2. In text field properties under 'Format' tab, format it as number and there is also an option to show negative number in red.

Translate
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 Beginner ,
Feb 27, 2024 Feb 27, 2024

Thanks for the reply.

1. The only thing to select in the 2 drop downs is a "X" or a "blank". If one drop down is selected, I need the other not to work. So it is wither or. The "In" drop down needs to result in a positive numbe and the "Out" needs to result in a negitive number in red. Both of these drop downs need to talk to the "Weight" column. (See attached)

2. I tried formating it as a number, but it wont let me because it is a letter. Should I maybe change it to a check box?

Thanks for all of your help.

Translate
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 ,
Feb 27, 2024 Feb 27, 2024

You want to show "Weight" field in red?

Let's say dropdown fields are named "In1" and "Out1", you can use this as custom calculation script of "Weight" field:

var dIn = this.getField("In1");
var dOut = this.getField("Out1");

dOut.readonly = (dIn.valueAsString === "X") ? true : false;
dIn.readonly = (dOut.valueAsString === "X") ? true : false;

event.target.textColor = (dOut.valueAsString === "X") ? color.red : color.black;

 

Translate
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 Beginner ,
Feb 27, 2024 Feb 27, 2024

Thank you for your help.

I am not understanding and tried to make the formula above for my pdf and cant get it to work.

Im no longer worried about the field turning red.

Im just going to try and get that drop down in the "OUTXRow1" to equal a negative number in the "WeightRow1" field.

Thanks

Translate
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 ,
Feb 27, 2024 Feb 27, 2024

Is the value of this field calculated, or does the user enter it manually?

Translate
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 Beginner ,
Feb 27, 2024 Feb 27, 2024

The vlue of the weight field is entered. The value of the out is a drop down that is an "X".

Thanks

Translate
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 ,
Feb 27, 2024 Feb 27, 2024
LATEST

OK, a bit confusing, but try this code as the custom calculation script of the Weight field:

 

if (this.getField("OUTXRow1").valueAsString == "X") event.value = Math.abs(event.value)*-1;

Translate
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