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

Help when a dropdown a is selected, next dropdown limited choices then select and populate text

Explorer ,
Oct 09, 2023 Oct 09, 2023

Copy link to clipboard

Copied

So, my boss has asked me to do a super difficult task in Adobe forms. He would like me to have a drop box that limits the choices in three-five other dropdown boxes. Based on the selection in the the other dropdown boxes, these are to populate up to three text fields with a numeric value. 

 

For example, in dropdown box 1, if I select either 'Fibreglass', 'Ceramic' or 'Glass', then in dropdown box 2/3/4/5, the options would be specific to each (e.g. fibreglass would have the options of Gas 30m, Solar 30m and Electric 30m in DB2 and Blanket 30m or Roller 30m in DB3 but if glass is selected, it would have Gas 50m, Solar 50m and Electric 50m and Blanket 50m or Roller 50m in DB2 ). Then, if an item is selected in DB2 like Gas 30m, three text fields would populate with '1', '2', and '3' with DB3/4/5 having their own individual selections that populate their own text fields.

 

I have the script for populating the the text fields from the dropdown box 2/3/4/5 selection but I have no clue as to how to find or create a script to limit the choices in dropdown box 2/3/4/5.

 

If you can help, that would be great. 

 

The script I have, which works perfectly, in 'validation' of the second dropdown (and would also go into the others as they have their own text fields to populate) is:

 

Note: S/L/V are the text fields

 

var S = this.getField("S1");
var L = this.getField("L1");
var V = this.getField("V1");

 

if(event.value == "Gas 30m"){
S.value = 1;
L.value = 2;
V.value = 3;}

 

else if(event.value == "Gas 40m"){
S.value = 4;
L.value = 5;
V.value = 6;}

 

else if(event.value == "Gas 50m"){
S.value = 40;
L.value = 50;
V.value = 60;}

 

else if(event.value == "Solar 30m"){
S.value = 41;
L.value = 51;
V.value = 61;}

 

else if(event.value == "Solar 40m"){
S.value = 45;
L.value = 55;
V.value = 65;}

 

else if(event.value == "Solar 50m"){
S.value = 49;
L.value = 59;
V.value = 69;}

 

else if(event.value == "Electric 30m"){
S.value = 48;
L.value = 58;
V.value = 68;}

 

else if(event.value == "Electric 40m"){
S.value = 47;
L.value = 57;
V.value = 67;}

 

else if(event.value == "Electric 50m"){
S.value = 49;
L.value = 59;
V.value = 69;}

 

else{
S.value = "";
L.value = "";
V.value = "";}

Views

371

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 , Oct 10, 2023 Oct 10, 2023

Votes

Translate

Translate
Explorer ,
Oct 09, 2023 Oct 09, 2023

Copy link to clipboard

Copied

Not an issue anymore but I do not know how to delete this post. If you have an answer, feel free to add it.

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 ,
Oct 10, 2023 Oct 10, 2023

Copy link to clipboard

Copied

i assume this is an acrobat question. and to help others, post your solution

 

=========================================

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">

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 ,
Oct 10, 2023 Oct 10, 2023

Copy link to clipboard

Copied

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
Explorer ,
Oct 14, 2023 Oct 14, 2023

Copy link to clipboard

Copied

Hi Try,

I have asked this on another one of my questions but I am not sure when that person will get back to me. I think this is also a good spot to ask.

My boss has given me to challenge that I am too new at doing. My boss wants me to popluate three text fields with the same total cost based on either a dropdown box OR two text fields multiplied by each other. The line reads like this

 

dropdown box OR $2 per sqm x _____sqms = total cost column 1     2      3

 

Do you have any suggestions on how to do this? Any help would be great. 

 

Tanya

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 ,
Oct 15, 2023 Oct 15, 2023

Copy link to clipboard

Copied

I can help, but you need to better explain the logic. When should the script use the drop-down value, and when should it sum up the fields, 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
Explorer ,
Oct 15, 2023 Oct 15, 2023

Copy link to clipboard

Copied

Hi Try. 

It may not be able to be done as the script would need to include both but have the text field populate with one or the other. A visual might help:

 

dropdown = total

OR

a x b = total

 

where total is in the same text field. If it is not doable, there is no stress as I can do the calcuations over two lines easily. I just have to convince the boss that might be the best option. 

 

This is the most complex form I had to create and now I need help with something else. Every time I think I have it all, the boss adds something new and complex. I def am way over my head at times.

I have been asked to have a dropdown display change to show the value of the dropdown once it is selected. So, if a dropdown box is 'car' in the list, once I select it, I need to have '$300' to show in the same box/space instead. 

 

The only way I can think of doing it is by having fields become visable based on the selection. Thankfully there are only 4 fields that would need to become visiable  and so I have used this script with success for each selection:

 

var nHide = (event.value=="Car ")?display.visible:display.hidden;
this.getField("Mini1").display = nHide; 

 

The problem is that I want the dropdown box to then disappear once I make the selection and the other field show and I cannot work out how to do that. But, and I don't think this could be doable, if I select the wrong thing and want to change the selection in the dropdown box, I want to be able to view the box again and change my selection. 

 

So, if you know of a way to get a dropbox to display values once selected or to have a dropbox disappear when selected but still be changed if needed, your help would be great.

 

I have been reading a number of your answers all and they have helped me greatly with a number of things I have done so far.

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
Explorer ,
Oct 15, 2023 Oct 15, 2023

Copy link to clipboard

Copied

Hi Try. 

I worked out what I am going to do. We have placed the dropbox at the top of each page with the same name (there are 3 pages that it will affect). In the drop box, I am using a variation of a script that I was given to populate multiple text boxes so that only the value shows in the places were I want it to show. The script is 

 

var S = this.getField("S1");
var L = this.getField("L1");
var V = this.getField("V1");

 

if(event.value == "Car"){
S.value = 1650;
L.value = 1650;
V.value = 1650;}

else if(event.value == "House"){
S.value = 5000;
L.value = 5000;
V.value = 5000;}


else{
S.value = "";
L.value = "";
V.value = "";}

 

Just thought to pass it on. 

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 ,
Oct 15, 2023 Oct 15, 2023

Copy link to clipboard

Copied

LATEST

Yes, that looks good!

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