<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to grey out OK button if user input is missing in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-grey-out-OK-button-if-user-input-is-missing/m-p/372293#M62222</link>
    <description>&lt;P&gt;You could use the Enable() message, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);


CheckInput = function({},
	write("here");
	UserInput1 = String1 &amp;lt;&amp;lt; get text();
	UserInput2 = String2 &amp;lt;&amp;lt; get text();	
	if(
		(length(UserInput1) &amp;gt; 0 ) &amp;amp; (length(Userinput2) &amp;gt; 0), 
		bbOK &amp;lt;&amp;lt; Enable(1), 
		bbOK &amp;lt;&amp;lt; Enable(0)
	)
);


// User Interface Window to get some data
UIwin = New Window( "User Input",
	Show Menu( 0 ),
	Show Toolbars( 0 ), 
	&amp;lt;&amp;lt;Modal,
	H List Box(
		V List Box(
			Panel Box( "",
					Spacer Box( size( 250, 5 ) ),
					H Center Box( Text Box( "User Input 1", &amp;lt;&amp;lt;Set Font Size( 11 ) ) ),
					H Center Box( String1 = Text Edit Box( "", Hint( "User Input 1" ), &amp;lt;&amp;lt;set width( 150 ), &amp;lt;&amp;lt; Set Script( CheckInput() ) ) ),
					Spacer Box( size( 5, 5 ) ),
								
					H Center Box( Text Box( "User Input 2", &amp;lt;&amp;lt;Set Font Size( 11 ) ) ),
					Spacer Box( size( 5, 5 ) ),
					H Center Box( String2 = Text Edit Box( "", Hint( "User Input 2" ), &amp;lt;&amp;lt;set width( 150 ), &amp;lt;&amp;lt; Set Script( CheckInput() ) ) ),
					Spacer Box( size( 2, 25 ) ),
				),
			),
		),
			bbOK = Button Box ("OK",
			UserInput1 = String1 &amp;lt;&amp;lt; get text();
			UserInput2 = String2 &amp;lt;&amp;lt; get text();	
			, &amp;lt;&amp;lt; Enable(0)			
		),
		Button Box ("Cancel", UIwin),
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 29 Mar 2021 14:39:01 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2021-03-29T14:39:01Z</dc:date>
    <item>
      <title>How to grey out OK button if user input is missing</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-grey-out-OK-button-if-user-input-is-missing/m-p/372270#M62219</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a modal window with "Ok" and "Cancel" button. How can I leave the "Ok" button greyed out if the user did not enter any information in one of the inputs?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// User Interface Window to get some data
UIwin = New Window( "User Input",
	Show Menu( 0 ),
	Show Toolbars( 0 ), 
	&amp;lt;&amp;lt;Modal,
	H List Box(
		V List Box(
			Panel Box( "",
					Spacer Box( size( 250, 5 ) ),
					H Center Box( Text Box( "User Input 1", &amp;lt;&amp;lt;Set Font Size( 11 ) ) ),
					H Center Box( String1 = Text Edit Box( "", Hint( "User Input 1" ), &amp;lt;&amp;lt;set width( 150 ) ) ),
					Spacer Box( size( 5, 5 ) ),
								
					H Center Box( Text Box( "User Input 2", &amp;lt;&amp;lt;Set Font Size( 11 ) ) ),
					Spacer Box( size( 5, 5 ) ),
					H Center Box( String2 = Text Edit Box( "", Hint( "User Input 2" ), &amp;lt;&amp;lt;set width( 150 ) ) ),
					Spacer Box( size( 2, 25 ) ),
				),
			),
		),
			Button Box ("OK",
			UserInput1 = String1 &amp;lt;&amp;lt; get text();
			UserInput2 = String2 &amp;lt;&amp;lt; get text();				
		),
		Button Box ("Cancel", UIwin),
);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:09:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-grey-out-OK-button-if-user-input-is-missing/m-p/372270#M62219</guid>
      <dc:creator>JMPPRO</dc:creator>
      <dc:date>2023-06-09T22:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to grey out OK button if user input is missing</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-grey-out-OK-button-if-user-input-is-missing/m-p/372293#M62222</link>
      <description>&lt;P&gt;You could use the Enable() message, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);


CheckInput = function({},
	write("here");
	UserInput1 = String1 &amp;lt;&amp;lt; get text();
	UserInput2 = String2 &amp;lt;&amp;lt; get text();	
	if(
		(length(UserInput1) &amp;gt; 0 ) &amp;amp; (length(Userinput2) &amp;gt; 0), 
		bbOK &amp;lt;&amp;lt; Enable(1), 
		bbOK &amp;lt;&amp;lt; Enable(0)
	)
);


// User Interface Window to get some data
UIwin = New Window( "User Input",
	Show Menu( 0 ),
	Show Toolbars( 0 ), 
	&amp;lt;&amp;lt;Modal,
	H List Box(
		V List Box(
			Panel Box( "",
					Spacer Box( size( 250, 5 ) ),
					H Center Box( Text Box( "User Input 1", &amp;lt;&amp;lt;Set Font Size( 11 ) ) ),
					H Center Box( String1 = Text Edit Box( "", Hint( "User Input 1" ), &amp;lt;&amp;lt;set width( 150 ), &amp;lt;&amp;lt; Set Script( CheckInput() ) ) ),
					Spacer Box( size( 5, 5 ) ),
								
					H Center Box( Text Box( "User Input 2", &amp;lt;&amp;lt;Set Font Size( 11 ) ) ),
					Spacer Box( size( 5, 5 ) ),
					H Center Box( String2 = Text Edit Box( "", Hint( "User Input 2" ), &amp;lt;&amp;lt;set width( 150 ), &amp;lt;&amp;lt; Set Script( CheckInput() ) ) ),
					Spacer Box( size( 2, 25 ) ),
				),
			),
		),
			bbOK = Button Box ("OK",
			UserInput1 = String1 &amp;lt;&amp;lt; get text();
			UserInput2 = String2 &amp;lt;&amp;lt; get text();	
			, &amp;lt;&amp;lt; Enable(0)			
		),
		Button Box ("Cancel", UIwin),
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Mar 2021 14:39:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-grey-out-OK-button-if-user-input-is-missing/m-p/372293#M62222</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-03-29T14:39:01Z</dc:date>
    </item>
  </channel>
</rss>

