Staying on a field

Peter Brigham MD pmbrig at gmail.com
Fri May 6 11:33:09 EDT 2011


On May 3, 2011, at 9:14 PM, Bill Vlahos wrote:

> I do a validity check on a field to see if the user entered a valid date. If the user entered a valid date and presses TAB or RETURN the focus moves on to the next field. However, if the user enters an invalid date I want to keep the focus on the field to try again.
> 
> This field script does everything correctly except that it doesn't set the focus back on the field. What am I doing wrong?
> 
> on closeField
>   if me is not a date then
>      answer error "Not a valid date. Retry?" with "No" or "Yes"
>      if it is "Yes" then 
>         focus on me
>         exit closeField
>      end if
>   end if
>   pass closeField
> end closeField

Is there some reason you use "focus on me" as opposed to "select text of me" ?

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list