These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Combobox to provide options for other comboboxes

Duniagdra
Registered: Sep 24 2008
Posts: 140
Answered

Just got "JavaScript - The Definitive Guide" and tried my best at writing out the following code based off sample code I found from this site's "ListProgramming_Part1.pdf":

function SetHeroicEntries()
{
 
var oAssemblyParts = { 
                       Cleric: [ ["-","None"], ["Angelic_Avenger"], ["Divine_Oracle"], ["Radiant_Servant"],["War_Priest"]],
                       Fighter: [ ["-","None"], ["Iron_Vanguard"], ["Kensei"], ["Pit_Fighter"],["Sword_Master]],
                      };        
 
   if(event.willCommit)
   {
      var lst = oAssemblyParts[event.value];
 
      if( (lst != null) && (lst.length > 0) )
         this.getField("ClassParagon").setItems(lst);
      else
      {
         this.getField("ClassParagon").clearItems();
      }
 
   }
}

To begin, I have a combobox called ClassHeroic that for now has the options of Cleric and Fighter. The script above I tried entering as a document level script and was going to add the function as a custom keystroke format; this is what was done in the example file.

I keep getting an error at Cleric regarding a literal. As much as I read the book, I have no idea what this means and am not knowing where to troubleshoot this.

My long term goal will be that once Cleric is selected another combobox (ClassParagon) will be made active with the Paragon selections in the array. I was also looking to have powers (power1 through 29) be made available in other selection boxes (comboboxes AtWill1 through 8 and Encounter1 through 10 and Daily1 through 10 and Utiiity1 through 8) elsewhere on the same sheet. I have no idea if that can be done. Is there another way for coboboxes to become active with selections based on the selection of one combobox? THis is a really big job I'm trying to tackle without know anything about javascript.

Am I trying to do something that can't be done?

Thanks in advance for any help anyone can provide in this.
Jim

Thanks in advance for any help provided,
Jim
The All Time Professional Amateur Hack

My Product Information:
Acrobat Pro 8.1, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
The "Sword_Master" string does not have a closing quote mark, which is probably the source of the error you're getting.

What you want to do can certainly be done. You're on the right track at least.

George
Duniagdra
Registered: Sep 24 2008
Posts: 140
George_Johnson wrote:
The "Sword_Master" string does not have a closing quote mark, which is probably the source of the error you're getting.What you want to do can certainly be done. You're on the right track at least.

George
Thanks George. I must have looked that over a dozen times and still never saw it. A new set of eyes found the obvious.

If I may ask though, is [b]my long term goal[/b] for these combobox menus possible? Last big paragraph in first post. Thanks for suggesting the book by the way. I'm trying my best with it. If it is, I"ll try hacking it first.

Thanks in advance for any help provided,
Jim
The All Time Professional Amateur Hack

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Yes, as I said before, what you want to accomplish can be done. The problem is it is somewhat advanced, so it may take a while if you're starting form scratch. Just keep at it, and good luck.

George
Duniagdra
Registered: Sep 24 2008
Posts: 140
George_Johnson wrote:
Yes, as I said before, what you want to accomplish can be done. The problem is it is somewhat advanced, so it may take a while if you're starting form scratch. Just keep at it, and good luck.George
Thanks

Thanks in advance for any help provided,
Jim
The All Time Professional Amateur Hack