Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

javascript with dropdown lists

Avatar

Avatar
Validate 1
Level 1
patpai
Level 1

Likes

0 likes

Total Posts

73 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
patpai
Level 1

Likes

0 likes

Total Posts

73 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
patpai
Level 1

11-05-2015


good morning everyone,

I'm playing around today with JavaScript code to add an "item" to my dropdown list if a certain condition is met.

The code seams to work if preview mode, but when I go back to designer mode and preview again, the item isn't really saved as an item of that dropdown list object, what am I doing wrong here?

Here is code:

If (d2 > tmpAprildate){

   xfa.host.messageBox("its greater then April 1st.");

   //add to dropdown list

   DropDownList1.addItem(curfy);

}else{

//do nothing

}

so I can see it being added to my drop list just by looking into it. But if I leave and come back, it needs to be added again as it didn't really save it

Thank you very much for your help again with this

Patrick

Accepted Solutions (0)

Answers (5)

Answers (5)

Avatar

Avatar
Validate 1
Level 1
patpai
Level 1

Likes

0 likes

Total Posts

73 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
patpai
Level 1

Likes

0 likes

Total Posts

73 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
patpai
Level 1

11-05-2015

thanks guys,

I now have something i can work with. I modified code to be set in the initialize phase so that i populate those with new data at that point.

My Fiscal year field now works

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,686 posts

Correct Reply

490 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,686 posts

Correct Reply

490 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

11-05-2015

The PDF-Preview creates a new temporary PDF file everytime you use it to view your form design.

That's why your always start with an empty dropdown.

Avatar

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct Reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct Reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
mouslander
Level 4

11-05-2015

Not sure what you mean. Can you explain what you want to do. That will help

Avatar

Avatar
Validate 1
Level 1
patpai
Level 1

Likes

0 likes

Total Posts

73 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
patpai
Level 1

Likes

0 likes

Total Posts

73 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
patpai
Level 1

11-05-2015

I see,

Is there anyway for me to code this differently so that it stays with the object after it's added?

I'm trying to build a Fiscal Year drop-down list that automatically updates itself once i year.

Thanks

Avatar

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct Reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct Reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
mouslander
Level 4

11-05-2015

when you add an item to a drop down using a script as you've done, it will not get added to the object in design view. It is added in real time.