Yes, what I do is name all my fields with the prefix fld, and my labels with lbl. This way I can distinguish between editable fields I created and things like, oh say, Datagrid fields.
Bob On Oct 26, 2011, at 2:43 PM, Ken Ray wrote: > > On Oct 26, 2011, at 11:19 AM, Bob Sneidar wrote: > >> Yes, you will need to write your own initialization routine. I do this >> anyway in all my forms because I read data into the fields, and then >> validate before writing them back to my storage. I always want to make sure >> I do not have any random data from a previous edit session making it's way >> into my database. Usually I have a populate handler that when passed empty >> for the arguement instead of a string or array, it puts empty into all my >> fields. Then I just call the populate handler when I open the form, >> typically in preOpenCard. > > > One thing to be careful about - NEVER do this (unless you are 100% sure): > > on preOpenCard > repeat with x = 1 to the number of fields > put empty into field x > end repeat > end preOpenCard > > It seems reasonable, but what it will do is to empty out your label fields as > well, which can be a real PITA to put back again. It's always better (IMHO) > to either address the fields you want to clear *directly*, like: > > on preOpenCard > put "FirstName,LastName,Age" into tFields > repeat for each item tField in tFields > put empty into field tField > end repeat > end preOpenCard > > OR, set some kind of custom property on the fields you want to clear (or > protect), or at least make sure you walk carefully on fields that have their > lockText turned on (which is what label fields have by default), like: > > on preOpenCard > repeat with x = 1 to the number of fields > if the lockText of field x is false then > if the short name of field x is not among the items of "PrefilledField, > DefaultCity" then > put empty into field x > end if > end if > end repeat > end preOpenCard > > Just my 2 cents… > > Ken Ray > Sons of Thunder Software, Inc. > Email: k...@sonsothunder.com > Web Site: http://www.sonsothunder.com/ > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode