For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2005 > Re: [PEAR] Using QuickForm_Controller









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Using QuickForm_Controller
Justin Patrin

2005-06-08, 8:57 pm

On 6/8/05, Ken Restivo <ken@restivo.org> wrote:
> I've spent the last month or so wrestling with QuickForm_Controller. I ha=

ve almost defeated it, but it is putting up one hellacious fight.
>=20
> The biggest challenge is that no code which makes use of $_REQUEST['blah'=

] can ever be expected to work with QFC. This is because QFC stores state i=
n $_SESSION in between requests, and looks there for everything. Of course,=
I stupidly had $_REQUEST crap all over my app.
>=20
> What I have had to do in order to make my application QFC-compatible is:
>=20
> 1) Replace all uses of $_REQUEST with $page->getSubmitValues(), or the va=

rious $controller->container() access hacks that are documented in QFC's FA=
Q, and

Actually, all QF code should really be using exportValues() as it
sanitizes and only returns the values that are actually *in* the QF.
This should have been expected.

>=20
> 2) Make sure that all my hidden's are actual $page->addElement('hidden', =

blah blah) in the parent form, instead of hacking them in using ->toHTML() =
methods.

Of course....if you're using raw HTML in your forms you're not using
QF as it's supposed to be used.

>=20
> This has often involved slipping references to the QF into my custom elem=

ents, much as Justin has done in his SubForm::setParentForm() method.

Hopefully this shouldn't be needed often.. Remember if you're doing
your own element you can always have a hidden element within it. You
can even extend the group element and do it that way. If you're using
a ref to the form you can most likely do it in a better way. THe only
reason SubForm has that ref is because it's a hack to make a form
within a form and I need to copy values from the main form.

>=20
> I'm just noting this so that it will appear in the archives; hopefully ot=

hers will Google for it and thus save themselves some pain in the future.
>=20



--=20
Justin Patrin
Ken Restivo

2005-06-09, 3:57 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Jun 08, 2005 at 01:59:20PM -0700, Justin Patrin wrote:
> On 6/8/05, Ken Restivo <ken@restivo.org> wrote:
ap all over my app.[color=darkred]
>
> Actually, all QF code should really be using exportValues() as it
> sanitizes and only returns the values that are actually *in* the QF.
> This should have been expected.
>


Thanks. Makes sense.

>
> Of course....if you're using raw HTML in your forms you're not using
> QF as it's supposed to be used.
>
>
> Hopefully this shouldn't be needed often.. Remember if you're doing
> your own element you can always have a hidden element within it. You


Really? How, exactly? I haven't seen any examples of this yet; didn't know it was possible.

> can even extend the group element and do it that way. If you're using
> a ref to the form you can most likely do it in a better way. THe only
> reason SubForm has that ref is because it's a hack to make a form
> within a form and I need to copy values from the main form.
>


- --
- ---------------
The world's most affordable web hosting.
http://www.nearlyfreespeech.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCp6eIe8HF+6xeOIcRAtf5AKD/Pr9sM//0TSuXioyKWZzjMUW/DgCcCtvB
pontRSxoMyZ43lCLPp5IAT8=
=zlf7
-----END PGP SIGNATURE-----
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com