How to tell if a field is "closed"?
Paul Dupuis
paul at researchware.com
Tue Feb 5 14:25:22 EST 2019
I have a problem for which I should probably redesign the user
interface, but would rather not do so for many reasons.
The problem is this:
1) There are some fields on a card. Each field has a "closeField"
handler that checks the fields content for validity and presents
appropriate error messages (via a standard 'answer" command).
2) There is an "Import" button that collects the field values and lots
of other data and does a task in my application.
3) If a user edits a fields and enters an invalid value and does not
click, tab, or press the return key to "close" the field and trigger the
"closeField" message, but immediately clicks on the "import" button, my
import script starts using the invalid value from the open field while
at the same time a closeField message does get send and an answer dialog
appears telling what is invalid about the entry.
However, my import routine is off and and running with bad data. I need
a way at the start of the import routine to ensure all fields are closed
- i.e. that their closeField handlers have ensured the field values are
correct.
In a worst case, I could solve this by a custom property for each field
- say valueOK - and set it to false on openField and true on closeFIeld
or exitFIeld if the edited value valid. The import button would then
check for any instances where the custom property 'vaueOK' is false, and
if there are any, exit without running and with an appropriate message.
However, I am wondering if anyone in the LiveCode brain trust has
figured out a better way to handle something like this?
More information about the use-livecode
mailing list