Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

still having problems with dropdown populate Script

Avatar

Level 3

Okay I have used the information I got off this forum to populate a drop down list in a repeatable subform with javascript (And it even works with FormCalc) Problem solved. But now when I test the script out in acrobat (with the calculations) The last item on my list does not seem to be working right. They are scripted like this on the preOpen event.

DropDownListName.additem("item 1","1.00");

DropDownListName.additem("item 2","2.00");

etc,

etc.

They are all the same, and they all show in the test. But when I click on the last item, it automatically inputs the first item onto the form, and for some reason I dont know, when I click on the down arrow of the drop box again, it will have my items listed 1-6 and then 1-6 again (Double listing the items). If I click on it a third time it will triple list the items... Weird! Maybe I am just tired, but more then likely I am doing something wrong (Again!) Anyone have any ideas?

One more thing so I dont have to add another post and can hopefully leave you people alone. How do I make the sum total field of a script so it rounds up to the nearest penny (1.856 = 1.86) or is that not easy

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The second issue of the additional items in the dropdown is easily sorted by including a line in the preOpen to clear the list first.

DropDownListName.clearItems();

This will need to go before the addItem script.

This will clear the existing list, before repopulating. You would tend to use addItems, where the list items will change depending on previous user interaction with the form.

In relation to rounding off the total, you can do it with script (check "Round" in the help file), but it is not necessary.

When you have the total object selected, just go to the Object/Field tab and click the patterns. Under the display tab you can select a currency pattern with currency symbol, thousand separator and to 2 decimal places (IF your object is a numeric field).

Parallels Desktop1.png

Good luck,

Niall

View solution in original post

7 Replies

Avatar

Correct answer by
Level 10

Hi,

The second issue of the additional items in the dropdown is easily sorted by including a line in the preOpen to clear the list first.

DropDownListName.clearItems();

This will need to go before the addItem script.

This will clear the existing list, before repopulating. You would tend to use addItems, where the list items will change depending on previous user interaction with the form.

In relation to rounding off the total, you can do it with script (check "Round" in the help file), but it is not necessary.

When you have the total object selected, just go to the Object/Field tab and click the patterns. Under the display tab you can select a currency pattern with currency symbol, thousand separator and to 2 decimal places (IF your object is a numeric field).

Parallels Desktop1.png

Good luck,

Niall

Avatar

Level 4

Niall,

What do you use to capture your beautiful screen snapshots  -  Captivate?

Captivate only or Captivate AND Acrobat, sometimes?

Avatar

Level 10

Hi Iakov,

Thank you!

In the Windows environment I used to use SnagIt, which was very intuitive. http://www.techsmith.com/screen-capture.asp.  There is a Mac beta of SnagIt, but I have used it much yet.

Most of the recent snaps were taken with Little Snapper for Mac. http://www.realmacsoftware.com/littlesnapper/

Both of these cost, but as I used them for work, it works out OK in the end.

Using one of these is so much easier and quicker than a screen dump.

Good luck,

Niall

ps: the captures are marked up in the application (eg Little Snapper) and then dragged to the desktop and uploaded onto the forums from there. They don't get process in any other application.

N

Avatar

Level 3

I was going to insert the pdf into here and show whats going on, but I don't see where I can. Sooo... I am stuck trying to explain it. The clear items worked as far as making the double and triple duplicates of the items in the drop down from appearing. But one of my items is still not selectable for some reason. It shows in the list, but when you scroll down to it and select it, the form field displays the first selection in the list. I thought maybe I had messed the code up (which is usually the case) but its written the same as every other line. I am stumped on that. Oh and thanks for setting me straight on how to add the dollar totals.Is there a way to add the file to show you here?

Avatar

Level 3

I figured it out. Sometimes I can work through these things. But it takes me hours. The solution was simple as it usually is. in my addItem I was using the value of two of my selections as ".08" and ."50" For some reason the .08 was working fine when it came to calculations and the ability to select the item. But the .50 was not selectable but visible. Anyway, wrote those values as 0.08 and 0.50 and everything works fine. Thanks for all the help with everything! I would be lost without the advice of everyone here

Avatar

Level 10

Hi,

The ability to upload files is temporarily turned off:

Safari.png

I am using Acrobat.com to share files.

...

see you have it sorted - Good!!

Niall