cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
ozs02
Level III

Force User to Provide Input Within Range

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.