Re: DB_Table QuickForm rules
| From: | Justin Patrin | Date: | Thu, 20 Apr 2006 21:44:51 +0000 |
| Subject: | Re: DB_Table QuickForm rules | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23781@lists.php.net to get a copy of this message | ||
On 4/20/06, Charlie van de Kerkhof <pear@mowd.nl> wrote:
> Hi,
>
> On 20 Apr 2006, at 23:07, Justin Patrin wrote:
>
> > The problem here is that you're using your own form. If you add an
> > element to your own form you have to add the rules as well. Rules are
> > *not* part of the element, they're added on their own.
> >
>
> That's true. I use my own form because I want to use a standard
> QuickForm renderer.
> And now for me everything is clear. Because I use my own form I can't
> use the benefits of DB_Table.
>
> > Your real problem is not that there is little documentation, your
> > problem is that you don't understand what you're trying to use here.
> > If you follow the normal example for DB_Table I'm sure the rules work
> > just fine. However, you're using its getFormElement method and adding
> > this to your own form. To use HTML_QuickForm manually (as you are) you
> > really need to understand how *it* works.
> >
> > Now...you should very easily be able to us eyour own renderer with the
> > form you get from DB_Table. The problem is likely that you aren't
> > doing it right because you don't understand the underlying packages.
> >
>
> It is my first time using PEAR packages and yes, still figuring out
> how some of them works.
> But how can I understand how *it* works? By reading documentation etc.
By reading the documentation, yes. There are docs for QF and there are
examples for the packages which should give you an idea of how they
work.
> Am I the only one that don't want the standard form with table output
> of getForm()?
Probably not.
> Should I understand how it works from the source code if I want to do
> something 'slightly' different?
> No one to blame btw... ;) Only myself.
>
> > Use the getForm() call. If it doesn't work there's something wrong
> > with how you're doing things. Try using print_r() on the various
> > objects, trace the code, etc.
>
> getForm() works perfect. But as I know now is that I can't use
> renderers from QuickForm in combination with DB_Table.
> Am I right?
No. Of course you can use another renderer. DB_Table simply gives you
a QF object which you can do whatever you want with, including
adding/removing elements, rules, setting options, etc. etc. Do the
same thing you're already doing except with the form that DB_Table
gives you.
>
> > And, just FYI, there is another package which does QF forms from a DB.
> > DB_DataObject_FormBuilder. Of course I've never used anything but the
> > default renderer with it.
>
> Thanx for the tip!
>
> I very sorry if I bothered you all with so much confusion and trouble.
> And I thank you all for your help and your patience.
>
--
Justin Patrin