|
Posted by Adrienne Boswell on 09/28/45 11:41
Gazing into my crystal ball I observed Good Man <heyho@letsgo.com>
writing in news:Xns977B721C4FAB1sonicyouth@216.196.97.131:
> The only point would be saving me programming time. On a page with 50+
> form-fields, I can save lot of time by writing a PHP loop that writes
> an HTML call to a javscript function instead of going to each form
> field and entering the value="<?= $first_name ?>" stuff...
>
I do it a little differently. I have two arrays, one for the names/ids of
the fields, and one for the default values. If the request method is get,
then the array with the default values is used for the field values,
otherwise, the form array is used for the field values. I also use a
little javascript which sets the value to blank on focus of the field, but
it gives the user a default value. When I check for required fields, I can
loop through the default values array to be sure they are NOT using a
default, eg. name=Your Name.
--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Navigation:
[Reply to this message]
|