cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

Force User to Provide Input Within Range

ozs02
Level III

Hi, I'm fairly new to JMP and I'm not sure how to write a script that throws an error to prevent the user from inputting an invalid number. I want the user to input a number that is eventually saved into a variable but re-prompt for input if the number is outside the range 1-4.

 

This is what I have so far without any error checking:

 

Names Default To Here (1);
num = 0;

w = New Window( "Prompt",
	<<Modal,
	<<return result,
	V List Box(
		Text Box( "Enter Number Between 1 and 4" ),
			str1 = Number Edit Box(num)
	),
);

input = w["str1"];

show(input);

Any help or suggestions on accomplishing this would be appreciated!

 

 

20 REPLIES 20
ozs02
Level III


Re: Force User to Provide Input Within Range

That's a good idea! Unfortunately with this, if the user accidentally types in 6 but really wanted to type 3 instead, their input will have been automatically chosen as 4. Sorry if the problem's a bit complicated.