Ask - cancel gives empty field

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Ask - cancel gives empty field

Post by Andycal » Mon Jul 23, 2007 2:57 pm

This is probably RunRev 101 stuff, but I'm having a problem getting my head around the syntax, so here goes:

I've got this code on a button:

on mouseUp
ask question "Please enter the ftp site address" with field "ftpField"
put it into field "ftpField"
end mouseUp

However, if I press 'cancel' the field is emptied, but I want it to stay as it was, i.e. no change.

How's this done?

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Mon Jul 23, 2007 3:02 pm

I fixed it!

Code: Select all

on mouseUp
  ask question "Please enter the ftp site address" with field "ftpField" titled "Enter FTP site details"
  if it is empty then
    exit mouseUp
  else
    put it into field "ftpField"
    end if
end mouseUp

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Mon Jul 23, 2007 6:28 pm

Exactly :-)


Best

Klaus

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”