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

Multiple Select List Box Problem

Avatar

Avatar
Validate 1
Level 3
johnqdaily
Level 3

Likes

0 likes

Total Posts

115 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 3
johnqdaily
Level 3

Likes

0 likes

Total Posts

115 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
johnqdaily
Level 3

13-08-2008

I have a multiple select list box with only 3 entries. I have been trying, with no luck, to program it so that when one specific entry is selected that a subform is made visible.



I have entry 1, 2, and 3 and if 2 is chosen then the subform is visible. I got that piece to work but if 1 and 2 or 2 and 3 or 1 and 2 and 3 are chosen then the subform is made visible otherwise it stays hidden.



For some reason I can't this to work.



Any thoughts?



Thanks in advance.



John

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

13-08-2008

Which event is your code running on that sets the presence of the subform? I would use the exit event and not the change event.



Also make sure that your form is set to be dynamic.

Avatar

Avatar
Validate 1
Level 3
johnqdaily
Level 3

Likes

0 likes

Total Posts

115 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 3
johnqdaily
Level 3

Likes

0 likes

Total Posts

115 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
johnqdaily
Level 3

13-08-2008

Paul,



Thanks for the quick reply.



I have it in the Exit event of the List Box in a dynamic pdf file. I think my code is flawed would you be willing to review it below?



---------Begin Code-----------

if ((($.boundItem(xfa.event.newText) eq 1) and ($.boundItem(xfa.event.newText) eq 2)) or (($.boundItem(xfa.event.newText) eq 2) and ($.boundItem(xfa.event.newText) eq 1))) then

topmostSubform.Page1.Subform15and16.Section15.SubformManufAddress.presence = "visible";

elseif ((($.boundItem(xfa.event.newText) eq 3) and ($.boundItem(xfa.event.newText) eq 2)) or (($.boundItem(xfa.event.newText) eq 2) and ($.boundItem(xfa.event.newText) eq 3))) then

topmostSubform.Page1.Subform15and16.Section15.SubformManufAddress.presence = "visible";

elseif ($.boundItem(xfa.event.newText) eq 2) then

topmostSubform.Page1.Subform15and16.Section15.SubformManufAddress.presence = "visible";

elseif ((($.boundItem(xfa.event.newText) eq 1) and ($.boundItem(xfa.event.newText) eq 3)) or (($.boundItem(xfa.event.newText) eq 3) and ($.boundItem(xfa.event.newText) eq 1))) then

topmostSubform.Page1.Subform15and16.Section15.SubformManufAddress.presence = "hidden";

elseif ($.boundItem(xfa.event.newText) eq null) then topmostSubform.Page1.Subform15and16.Section15.SubformManufAddress.presence = "hidden";

endif

---------End Code-----------



Thanks!



John

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

13-08-2008

That code will not work on the exit event. The xfa.event.newText will only be available to th echnage event (while the listbox has focus). Also the newText can only have one value, the last one selected. If you want to stay with the multiselect you can use the rawValue property to get waht was selected by the user. If multiple selections are choosen then you will get a rawValue of One Two. I suggest putting a message out to the screen to see what the values that you need to test are. You can do this by using an app.alert(this.rawValue) if you are using JavaScript or a xfa.host.messageBox($.rawValue) if you are using FormCalc.



Make sense?

Avatar

Avatar
Validate 1
Level 3
johnqdaily
Level 3

Likes

0 likes

Total Posts

115 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 3
johnqdaily
Level 3

Likes

0 likes

Total Posts

115 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
johnqdaily
Level 3

13-08-2008

Paul,



The message box was very helpful. I still wasn't able to perform some sort of equality check on the raw values.



The data appeared like below:

1

2



I think I was making the whole idea too complicated once I really thought about it. I wasn't able to use the list box and went to something else.



Thanks for your help!



John

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

13-08-2008

I agree ...it was too compicated.

Avatar

Avatar
Validate 1
Level 4
Ryan_Lunka
Level 4

Likes

11 likes

Total Posts

143 posts

Correct Reply

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

Avatar
Validate 1
Level 4
Ryan_Lunka
Level 4

Likes

11 likes

Total Posts

143 posts

Correct Reply

11 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Ryan_Lunka
Level 4

18-08-2008

I feel like you may be making this more complex than it needs to be. Instead of writing all of those IF statements, why can't you just say "if the specific selection is selected" make the subform visible. You should be able to use indexes to programatically refer to the item in the list box you need. As long as you aren't dynamically populating the list box you should be fine. Also, Paul is right, newText won't work there.