Re: can't get [PEAR] DB_DataObject_FormBuilder to build a form
| From: | Justin Patrin | Date: | Thu, 23 Dec 2004 23:02:17 +0000 |
| Subject: | Re: can't get [PEAR] DB_DataObject_FormBuilder to build a form | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16443@lists.php.net to get a copy of this message | ||
On Thu, 23 Dec 2004 14:54:18 -0800 (PST), l Burnerheimerton
<lburnerheimerton@yahoo.com> wrote:
> Thanks. Yeah, I should have caught that variable problem.
>
> What I will be searching for first include:
Make sure to look at this before using the configration options:
http://opensource.21st.de/tiki-index.php?page=Configuring+Formbuilder
The last option is the one I use almost exclusively.
> 1 - how to make certain fields hidden
Look at fieldsToRender and userEditableFields. If you want it to be an
actual "hidden" input type, the best way is to use preDefElements in
preGenerateForm.
> 2 - how to make other fields display as textarea instead of text type
Look at textFields.
in the DO:
var $fb_textFields = array('textField1', 'textField2');
You can change their sizes in postGenerateForm
in the DO:
function postGenerateForm(&$form) {
$el =& $form->getElement('textField1');
$el->setCols(40);
$el->setRows(20);
}
> 3 - how to delete a record
FB doesn't do this, it's is up to you. My Frontend package does, though. ;-)
http://www.reversefold.com/tikiwiki/tiki-index.php?page=DB_DataObject_FormBuilder_Frontend
>
> It's cool how it knows whether to add or edit. This will work great
> especially for the forms that do not require custom validation
> rules/functions in QuickForms - I have several already - like one that
> checks for unique values as a custom validation rule. I saw that it is
> possible to do this in fb but, quite frankly, I need to get this out the
> door.
Best way to add new rules is in postGenerateForm().
>
> Your help has been most appreciated!
>
> Best regards
>
>
> Justin Patrin <papercrane@gmail.com> wrote:
>
> On Thu, 23 Dec 2004 12:54:03 -0800 (PST), l Burnerheimerton
> wrote:
> > The code below is what he suggested and worked. Actually before changing
> > much of it, I just changed:
> >
> > $review = DB_DataObject::factory('building');
> > $builder =& DB_DataObject_FormBuilder::create($building);
> >
> > to
> >
> > $building = DB_DataObject::factory('building');
> > $builder =& DB_DataObject_FormBuilder::create($building);
>
> Hehe...just a variable name. Sorry about that, I missed it too. I
> usually assume that people catch that stuff on their own. ;-) Glad you
> got it working.
>
> >
> > and it worked. But I went further on his suggestion and chnaged it to
> > include the error checking as below.
> >
> > Now I have to delve into how to write QuickForm code through Form_Builder
> -
> > I was just getting confortable with QuickForm ;-)
>
> Well, it does most of it for you. You can pre-create elements if you
> *must* with the preGenerateForm callback and you can customize the
> auto-created ones in postGenerateForm. These are on the wiki you
> mention below in the callbacks section.
>
> >
> > Seriously, I REALLY like what you guys have built.
>
> Glad you like it. Suggestions are welcome. Tutorials are even more
> welcome. :-) Many people have proposed them, but no one has submitted
> one yet...
>
> >
> > I am to the following sites for more learning. If you have more where I
> can
> > get up to speed on how to format the output of fields, I'd appreciate you
> > posting those. Thanks again.
>
> The rest of the pages on that wiki are also important. If you haven't
> been there yet, start from this page:
>
> http://opensource.21st.de/tiki-index.php?page=DB_DataObject_FormBuilder
>
> >
> >
> > http://opensource.21st.de/tiki-index.php?page=Beyond+Advanced
>
> I'm proud of this one (as I am in general of FB). It's mostly my own
> ideas when playing wround with DO and FB in my own apps. I use
> "virtual fields" quite often to make something look like one record
> when it's in fact more like 3 or 4. :-)
>
> --
> Justin Patrin
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Justin Patrin