home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!yale.edu!yale!gumby!destroyer!ncar!ncar.ucar.edu!hpoppe
- From: hpoppe@ncar.ucar.edu (Herb Poppe)
- Newsgroups: comp.sys.mac.hypercard
- Subject: Validating Data Entry in a Field: Conclusion
- Message-ID: <1992Aug28.215657.18269@ncar.ucar.edu>
- Date: 28 Aug 92 21:56:57 GMT
- References: <1992Aug18.202825.24625@ncar.ucar.edu>
- Sender: news@ncar.ucar.edu (USENET Maintenance)
- Organization: National Center for Atmospheric Research
- Lines: 34
-
- In article <1992Aug18.202825.24625@ncar.ucar.edu> hpoppe@ncar.ucar.edu
- (Herb Poppe) writes:
-
- > I need to ensure that a user correctly enters data into a field. I want
- > the selection point to remain in the field until a correct value is
- > entered. HyperTalk allows me to trap user attempts to "escape" the field
- > by typing TAB or RETURN or ENTER. However, I see no convenient way to
- trap
- > the user's clicking a button, in another field, or in the card, thus
- > leaving an invalid value left in the field. Have a missed an obvious (or
- > not so obvious) approach to this issue?
-
- Thanks to all who replied via e-mail and netnews postings. My conclusion
- is that there is no straightforward way of doing what I wanted.
-
- I found I was getting all wrapped up in this issue, and forgetting that I
- was creating a "throw-away" stack to answer a particular question. So,
- rather than insisting on "doing it my way", I took the advice of someone
- who suggested an approach used in the Valid Entry Package, a stack written
- by someone at Apple that is available on the Developer CDs. Basically, if
- the field is in error at closeField/exitField time, replace the data the
- user entered with the previously entered value (presumably correct).
- Since what I was entering were long bit strings, I didn't want to adopt
- exactly this approach, since it meant retyping in that long string of
- bits. Instead, I set the style of the text to italic as a reminder
- that the data was in error. Also, I just blanked those (locked) fields
- whose values were derived from the incorrect value. Also, the fields have
- a keyDown handler which checks for errors that can be determined when a
- character is typed, and discarding that character after a warning alert.
- This reduces the errors that are reported at closeField time.
-
- Herb Poppe National Center for Atmospheric Research (NCAR)
- hpoppe@ncar.ucar.edu 1850 Table Mesa Dr.
- (303) 497-1296 Boulder, CO 80303
-