cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar

Modal windows - the "OK" button

Hi - I want to create a modal window that requests a response from the user, something like this:

teb = text edit box("");

ok = button box("OK");

nw = new window("My Modal Window", << modal(1),

    h list box(text box("Type here: "), teb),

    ok

);

How can I prevent the window from closing if the user clicks on “OK” without supplying a response?  I’ve tried adding assorted scripts to the “OK” button to see if teb contains a string of greater than zero length, and then only closing the window if it has, but I can’t seem to find the right syntax: the window always closes regardless.

I note that the window supplies an "OK" button even if I don't include it (presumably because it has to have one), so I'm wondering whether it is replacing my "OK" button with one of its own.  Is it possible that that's the problem?

Many thanks

11 REPLIES 11
txnelson
Super User

Re: Modal windows - the "OK" button

your IF/Then logic will have to be made a part of each of the text items, so that code is executed when any of the text edit boxes change in value.

Jim
Tina
Level III

Re: Modal windows - the "OK" button

Thank you very much. That seems to work!