setDefaults vs constants vs setValue
| From: | Ken Restivo | Date: | Mon, 10 Oct 2005 02:07:36 +0000 |
| Subject: | setDefaults vs constants vs setValue | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-21299@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I just discoverd that, despite using QF for over a year-and-a-half now, I don't have a really
deep understanding of when to use submitted values ($_REQUEST), setDefaults, setValue, and
setConstants. The docs are good on all three, but don't describe the *interations* between all
three.
What I want to know is:
1) What is the precedence of each (rock, paper, scissors)? I thought that setDefaults were
overridden by setValue, but in my own application I've discovered that's wrong.
setDefaults will clobber what I set with setValue, if I setValue first.
So specifically, which of these will clobber the others *IFF* there is some previous value already
set, and which of the four ($_REQUEST, setDefaults, setConstants, setValue) can set them such that
they cannot be overriden by others of the three? Obviously setConstants overrides $_REQUEST and
setDefaults, but what other interactions are there? Do any of the three check first and decline to
clobber existing values?
2) When to use each? What typical situations would you use one or the other? When *not* to use each
of the three? At which stage in the form are each most appropriate?
If there already is a good compare-and-contrast tutorial (or a table, is really what I'm
looking for), please feel free to just point me at it. But there is so much "flexibility"
with all these different methods that I'm just befuddled trying to figure out how they
interact.
So far it looks like the order of precedence is:
a) setconstants
b) setdefaults
c) setvalue
d) $_REQUEST
But I'm not sure. And, also, will any yield to previous values already present?
- -ken
- --
- ---------------
The world's most affordable web hosting.
http://www.nearlyfreespeech.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDSczoe8HF+6xeOIcRAlU0AJ0QrDjLKpAlWBbjGJiQ4ph578eATgCZAS7C
fv/jplN/U1Zvq4C5QC3c+XI=
=De/I
-----END PGP SIGNATURE-----