Im trying to validate user input and prevent them from passing the Input UI if they do not enter required fields. So far it seems like the button box doesnt actually run the script in sequence, or it doesnt seem to store the variables until the entire script is finished. How can I get around this?
clearLog();
clearGlobals();
clearSymbols();
dt = currentDataTable();
inputGUI = newWindow( "Input Selection UI", << modal,
//Step Name input box
hListBox(
textBox("1. Enter some text input"),
stepTextEdit = textEditBox(),
),
//Column Section input box
hListBox(
vListBox(
choosesrc=filterColSelector( nLines( 6 ) ),
chooseSRC << numeric( 0 ),
),
vListBox(
lineUpBox( nCol( 1 ), spacing( 2 ),
buttonBox( "Add Column >>",
listcols2 << Append( chooseSRC << getSelected );
),
buttonBox( "<< Remove Column",
listcols2 << removeSelected;
),
),
),
vListBox(
listcols2 = colListBox( nLines( 3 ), minItems(1), maxItems(1) ), //col list box with no columns inside
);
),
//Footer Section and OK/Cancel Buttons
hListBox(
buttonBox("OK",
//Collect all variables from input boxes
uinp_stepName = stepTextEdit << getText;
uinp_colssrc=listcols2 << getItems;
// Input Validation Logic
if ( IsMissing(uinp_stepName) == 1,
(nw_error_uinp_stepName = New Window("Error ", << Modal,
VList Box(
Text Box("Text input is missing"),
HList Box(
Button Box ( "OK" ),
),
);
);
break(); // Only send 1 error at a time
)
);
if ( nItems(uinp_colsSRC) == 0,
(nw_error_uinp_colssrc=New Window("Error ", << Modal,
VList Box(
Spacer Box( Size (5, 5) ),
Text Box("Column input is missing"),
Spacer Box( Size (15, 15) ),
HList Box(
Button Box ( "OK" ),
),
);
);
break(); // Only send 1 error at a time
)
);
),
buttonBox("Cancel", Print("User cancelled operation!"); Stop() ),
),
);