When has a field changed?

Bob Sneidar bobs at twft.com
Tue Oct 25 18:10:40 EDT 2011


yes. on closeField. However be aware that clicking a button before tabbing out of the field will NOT send a closeField to an edited field. Someone sent me a workaround for that, but I cannot find it right now. I am sure it is in the archives. Note that exitField is sent when a field loses focus, whether any edits were made or not. CloseField only gets sent when the field has been edited. 

I will say that validations on leaving a field can be dicey. Let's say a field contains the value "Bears". Later you create a validation that only allows a subset of dog breeds, and you validate upon exit whether or not anything has changed. Empty is not a valid entry. You will end up locking your user into the field and the only way out is to enter a random dog breed that may not apply, but is the only way out. 

I would only use what I call mid-validations (as opposed to pre-validations to precheck and format data before putting it into a field or post-validations to pre-check or format data before writing it to a database) to do things like phone number formatting, zip code formatting, upper and title case formatting etc. Nothing that will halt the user and demand he do something different. Just my 2¢

Bob


On Oct 25, 2011, at 2:21 PM, James Hurley wrote:

> I have a text field (unlocked) that the user can edit, but  I want to know when and to deal with the changes.
> 
> Here is what I have come up with, something of a kludge. Is there a cleaner way?
> 
> on mouseEnter --Enter the field
>   set the textChange of me to false
> end mouseEnter
> 
> on rawkeydown tKey
>   if the textChange of me is true then
>      pass rawKeyDown
>   else
>      set the textChange of me to true
>      pass rawKeyDown
>   end if
> end rawKeyDown
> 
> on mouseLeave
>   if the textChange of me is false then 
>      exit mouseLeave
>   else
>      send "mouseUP" to button "ProcessChanges" --This is where the change is dealt with.
>   end if
> end mouseLeave
> 
> 
> Jim Hurley
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list