Expand my Community achievements bar.

SOLVED

Dependent Drop down boxes (sample attached)

Avatar

Level 6

First try with variables so please bear with me.  Two drop down lists.  User selects a court location.  Based upon selection the second drop list provides a list of employees. Barnstable & Bristol selections work as intended.  But the Berkshire probation officer list has "empty" on the bottom.  How the heck do I get rid of "empty"?  I've included notes with the script in the sample.

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hope you have resolved it your self.....if not here is how I resolved it..........

function getPOOther(myXfa, dropdownField)
{                                             
   dropdownField.clearItems();       // Clear the items of the Drop-down list.
   for (var i=0; i < myCourts.length; i++)   // Look through all the courts until we find the one that matches the court selected.
      if(myCourts[i][0] == myXfa.event.newText)  // Check to see if they match. Note: we have to use the event.newText in this case because
   {                                              // the change hasn't been committed yet.
    var varma1
      for (var j=1; j < myCourts[i].length; j++)  // When they match, add the states/provinces to the Drop-down List.
   {
   varma1 = myCourts[i][j]
   if (varma1.length >= 0) dropdownField.addItem(varma1); //to eliminate undefined
    }
   dropdownField.rawValue = myCourts[i][1]; // Display the first item in the list.
   }
}

View solution in original post

11 Replies

Avatar

Level 1

Hi, I'm a newbie at Livecycle, and I'm trying to make my drop down menus do what those two did, but I have no idea how you did that.  I downloaded the file, but how did you get the variables to work like that?  Where is the information coming from?  I'm so confused and would be very grateful for any help that I can get.

Avatar

Level 6

Open the sample and in the hierarchy pane, select the CourtScript under variables.

Look in the scripting window.  My notes are in green.

Array=the number of choices within each drop category (I know it's confusing)

take my sample and substitute (overwrite) some of your data and play with it.

You'll see how it works.  Given the lack of responses, this must be confusing to

many more than you & me

Avatar

Correct answer by
Level 6

Hope you have resolved it your self.....if not here is how I resolved it..........

function getPOOther(myXfa, dropdownField)
{                                             
   dropdownField.clearItems();       // Clear the items of the Drop-down list.
   for (var i=0; i < myCourts.length; i++)   // Look through all the courts until we find the one that matches the court selected.
      if(myCourts[i][0] == myXfa.event.newText)  // Check to see if they match. Note: we have to use the event.newText in this case because
   {                                              // the change hasn't been committed yet.
    var varma1
      for (var j=1; j < myCourts[i].length; j++)  // When they match, add the states/provinces to the Drop-down List.
   {
   varma1 = myCourts[i][j]
   if (varma1.length >= 0) dropdownField.addItem(varma1); //to eliminate undefined
    }
   dropdownField.rawValue = myCourts[i][1]; // Display the first item in the list.
   }
}

Avatar

Level 1

So, how would you add a third drop down menu?

I inputed all of my information, but I also want a third drop down that is dependent on my selection from the second drop down.  Is there a simple way to do that?

Thanks

Avatar

Level 6

Add another variable with a similar script to control the interaction between the second drop down list and the new drop down list  you'll add

Avatar

Level 2

Can you send me a sample of how to add a third drop down lists

Avatar

Level 1

Whilst this thread is old and for earlier versions of LiveCycle it seems a good place to post the following question - which relates to the problem of linking 3 (or more) dropdown lists in LiveCycle Designer and in particular whether I can use the script on javascript.com referenced by paulk07 above. The script seems to be written for a webpage rather than for LiveCycle Designer.

I am struggling with this and some other potential solutions presented elsewhere e.g. by Thom Parker in a tutorial. However, to my untrained eye the solution presented on javascript.com seems very efficient and an elegant solution to the problem - if only I could get it to work within the LiveCycle Designer ES4 environment.

I have copied the script portion of what is on javascript.com into a script object and created the dropdown lists required into a form (combo_0, combo_1 etc.) but cannot get the dropdown boxes to respond to the "change" function within the script. I have tried referencing the "change" function in the script object in various events for each dropdown object (e.g. initialize) but to no avail.

Clearly, I'm missing something fundamental and was wondering if there is a simple solution to the problem?

Or perhaps it requires some further functions and coding along the lines of paulk07's response No.5 on 28th Sept 2009 which would be beyond me.

I would be grateful if anyone could point me in the right direction.

P.S. This is a first time post so please accept my apologies for any transgressions or incomplete information.

Avatar

Level 1

Hi, do you have one pdf sample file with your code inside?

Avatar

Level 1

Tks!

Cristian Vita

Il giorno 11 nov 2019, alle ore 03:16, anr79225694 <forums_noreply@adobe.com> ha scritto:

Dependent Drop down boxes (sample attached)

anr79225694 marked cris vita's reply on Dependent Drop down boxes (sample attached) as helpful. View the full reply

Marked as helpful:

Hi, do you have one pdf sample file with your code inside?

Following Dependent Drop down boxes (sample attached) in these streams: Inbox

This email was sent by Adobe Community because you are a registered user.

You may unsubscribe instantly from Adobe Community, or adjust email frequency in your email preferences