cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
aallman
Level III

Get Selection from List Box

I am running into a problem where if the user selects one option from my list box and then changes it before finishing with the modal window, the script errors out and thinks there is nothing selected from the list box. I have no idea what is causing this problem or how to fix it. Right now my modal window requires an entry into a text edit box and a selection from a list. I have my modal window set so that there is an "On validate" script that will say enter text or choose from the list if one is missing. right now I am just practicing running it and I keep getting the "select from list" message even though there is clearly something selected in my list.

 

What is going on???? This is the modal window part of my script.

Win1 = New Window( "7 Day Procedures",
	<<Modal,
	<<On Validate(L=l<<Get Selected indices;
		If( !Is Missing( UserIDBox << Get Text ) & N Items( L=l<<GetSelectedindices ) != 0,
			Return( 1 ),
			If(
				Is Missing( UserIDBox << Get Text ),
					tb << Set Text( "Please enter a User ID." );
					Return( 0 );,
				N Items( L=l<<GetSelectedindices ) == 0,
					tb << Set Text( "Please select a location." );
					Return( 0 );
			)
		)
	),
	Show Menu( 0 ),
	Show Toolbars( 0 ),
	H List Box(
		V List Box(
			Text Box( "Enter User ID:", <<Set Font Size( 10 ), <<Margin( Right( 0 ), Top( 10 ), Left( 0 ), Bottom( 10 ) ) ),
			UserIDBox = Text Edit Box( "",
				Hint( "ex. LAP-JSCHMOE" ),
				<<Set Script( ID = UserIDBox << Get Text ),
				<<Margin( Right( 0 ), Top( 0 ), Left( 0 ), Bottom( 20 ) )
			),
			Spacer Box( 20, 20 ),
			Text Box( "Select Location:", <<Set Font Size( 10 ) ),
			l = List Box(
				{"Coralville", "San Diego", "Leuven", "Singapore"},
				Max Selected( 1 ),
				NLines( 4 ),
				<<Margin( Right( 0 ), Top( 10 ), Left( 0 ), Bottom( 20 ) ),
				<<Set Script(L=l<<get selected indices),
				
			), 
		Print(L);
			Spacer Box( 20, 20 ),
			Text Box( "Would you like to filter the query?", <<Set Font Size( 10 ) ),
			bb = Check Box( "Yes", <<Margin( Right( 0 ), Top( 5 ), Left( 0 ), Bottom( 20 ) ), <<Script( if << Set( bb << get );L=l<<Get Selected indices ) ), 
		
			Spacer Box( 20, 20 ),
			H List Box( Button Box( " OK " ), Button Box( " Cancel " ) ),
			tb = Text Box( "", <<set font size( 12 ) ), 

		), 
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Get Selection from List Box

In the OnValidate function, you set:

 

L=l<<Get Selected indices

 

JSL is not case-sensitive, so the variable 'l' no longer refers to the List Box after the first statement.

View solution in original post

1 REPLY 1

Re: Get Selection from List Box

In the OnValidate function, you set:

 

L=l<<Get Selected indices

 

JSL is not case-sensitive, so the variable 'l' no longer refers to the List Box after the first statement.