Page 1 of 1
How to know when user has edited a field?
Posted: Sat Oct 06, 2012 10:10 pm
by sritcp
I see that, on iOS, the message inputTextChanged is sent.
What about OSX? In general, how is this recognized, so the program can prompt the user to save the changes?
Thanks,
Sri.
Re: How to know when user has edited a field?
Posted: Sat Oct 06, 2012 10:12 pm
by sturgis
Not sure its in the dictionary yet, but if you have 5.5 (I think that is when it showed up) you can use the textChanged message.
Re: How to know when user has edited a field?
Posted: Sat Oct 06, 2012 10:15 pm
by sritcp
Yes, I have LC 5.5
No, textChanged is not in the (downloaded) dictionary.
Thanks, sturgis!
Sri.
edit: not in the online dictionary either!
Re: How to know when user has edited a field?
Posted: Sat Oct 06, 2012 10:40 pm
by Klaus
It is in the dictionary in LC 5.5.2.
But maybe you are looking for "closefield", which seems to be a better time to ask the user to save his changes.
If this would happen every time if a new character is entered in a field, this MIGHT disturb the user a BIT!
Best
Klaus
Re: How to know when user has edited a field?
Posted: Sat Oct 06, 2012 11:21 pm
by sritcp
Klaus:
closeField is no good when the user is filling out a form with a number of fields, e.g., Name, Date of Birth, etc.
We need to stop him only when he does something (like leaving the card) without saving the changes.
Of course, we don't disturb him after every character! I have a global variable gEdited which is initialized to false.
The textChanged message handled by the group containing the fields sets gEdited to true.
When the issue is resolved (saved or discarded), gEdited is reset to false.
Thanks,
Sri.
Re: How to know when user has edited a field?
Posted: Sat Oct 06, 2012 11:22 pm
by sritcp
A follow-up question:
Is the textChanged message sent only on user input
or, even when the field text is changed by the program through script?
Thanks,
Sri.
Re: How to know when user has edited a field?
Posted: Sat Oct 06, 2012 11:45 pm
by sturgis
Programming also triggers textChanged. As Klaus pointed out though, if you only want to remind prompt the user after they manually change the field, closefield is the way to go.
Re: How to know when user has edited a field?
Posted: Sun Oct 07, 2012 2:20 am
by sritcp
Yes, I see that!
Thanks,
Sri.
Re: How to know when user has edited a field?
Posted: Sun Oct 07, 2012 10:52 am
by Klaus