cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Neo
Neo
Level VI

How to handle unchecking a checkbox error?

I want the user to select only one item using the following e.g.

Names Default To Here( 1 );
New Window( "Example",
	cb = Check Box(
		{"Max", "Median", "Min", "Mean", "Std Dev"},
		returned = (cb << Get Selected ())[1];
		Print( returned ) //{"Mean", "Std Dev"} or etc
	)
);

The above works, but if the user checks and then unchecks the checked box, JMP throws an error as it can no longer execute 

returned = (cb << Get Selected ())[1];

How to handle this by perhaps showing a dialog to the user saying that "user must select only option to proceed"?

 

Also, is it possible to start with a check box already checked? If so, how?

 

 

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to handle unchecking a checkbox error?

If you want user to select only one option, use radio box or combo box instead of check box.

 

If you want to use check box, remove the index and add check for length of the list

Names Default To Here( 1 );
New Window( "Example",
	cb = Check Box(
		{"Max", "Median", "Min", "Mean", "Std Dev"},
		returned = (cb << Get Selected ());
		If(N Items(returned) >= 1,
			show(returned);
			show(returned[1]);
		);	
	)
);
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to handle unchecking a checkbox error?

If you want user to select only one option, use radio box or combo box instead of check box.

 

If you want to use check box, remove the index and add check for length of the list

Names Default To Here( 1 );
New Window( "Example",
	cb = Check Box(
		{"Max", "Median", "Min", "Mean", "Std Dev"},
		returned = (cb << Get Selected ());
		If(N Items(returned) >= 1,
			show(returned);
			show(returned[1]);
		);	
	)
);
-Jarmo