ask dialogue - empty vs. cancel

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
witeowl
Posts: 45
Joined: Mon Feb 21, 2011 3:02 am

ask dialogue - empty vs. cancel

Post by witeowl » Wed Apr 13, 2011 9:23 pm

With the ask dialogue, is there a way to differentiate between an empty response and the user hitting cancel?

Here's the scenario: I have an email field populated with data (if it exists). If the user clicks on the field, "ask" will come up, pre-populated with the email from the field (for easier editing). If the user hits cancel, I want nothing to change, but if the user deletes the email and hits OK with an empty field, I want the field to be cleared.

The problem is that "it" appears to never be "cancel" with an ask dialogue, so the user hitting cancel and the user clearing the field both trigger "if it is empty".

Suggestions?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: ask dialogue - empty vs. cancel

Post by Klaus » Wed Apr 13, 2011 9:31 pm

Hi whiteowl,

you can check "the result" which will be "cancel" if the user had hit "cancel"
and use IT, no matter if IT is empty or not.

Code: Select all

...
ask....
if the result = "cancel" then
 exit to top
end if
## Now you can do whatever you want with IT
...
Hope that helps!


Best

Klaus

witeowl
Posts: 45
Joined: Mon Feb 21, 2011 3:02 am

Re: ask dialogue - empty vs. cancel

Post by witeowl » Wed Apr 13, 2011 9:34 pm

That does, thanks!

Post Reply