Skip to main content
Inspiring
October 10, 2023
Answered

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

  • October 10, 2023
  • 3 replies
  • 1657 views

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 = "";}

    This topic has been closed for replies.
    Correct answer try67

    I just answered a very similar question. See: https://community.adobe.com/t5/acrobat-discussions/script-help-acrobat/m-p/14145837#M433288

     

    3 replies

    try67
    Community Expert
    try67Community ExpertCorrect answer
    Community Expert
    October 10, 2023
    Inspiring
    October 15, 2023

    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

    try67
    Community Expert
    Community Expert
    October 15, 2023

    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?

    kglad
    Community Expert
    Community Expert
    October 10, 2023

    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">
    Inspiring
    October 10, 2023

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