Re: DB_DataObject_FormBuilder

From: Date: Fri, 28 May 2004 22:44:19 +0000
Subject: Re: DB_DataObject_FormBuilder
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12782@lists.php.net to get a copy of this message
Sarah Gray wrote:
Hi -- I see that FormBuilder is in beta and I've been playing around with it some. it's really nice. What's the status of it? Are people using it in production? Is it moving from beta to stable (with more thorough end-docs than those in the code) anytime soon? Does it (will it? should it?) work with smarty? I've found a few usage examples out there (http://norbert.mocsnik.hu/crosslink-triplelink-example.phps etc). Do others have usage examples or tips? For example -- setting form order and laying out forms: what methods should we look to for this? Any words / status / higher-level ruminations would be much welcomed and appreciated. Thanks-- s.
:-) I've been working with this for a while now. I actually wrote an app that lets you edit your DB data (with links and such) without writing any code (just set up DB_DO and your links.ini). It hasn't been updated in a while, but it may be a bit useful to you. http://sourceforge.net/projects/rdbedit/ I've also been working it into some production projects and have been hammering out errors and inconsistencies (and filing bug reports with patches, of course). It looks like it may be ready for stable some time soon if we can get some more testing. BTW, the example you mentioned is for a new feature that isn't even in CVS yet, so I wouldn't try to use it. ;-) Smarty: Yes, I believe it can work with smarty through QuickForm's ArraySmarty renderer, but I haven't used it myself, so don't quote me on that. Form Order: The array preDefOrder can be used to give an ordering for your form elements. This array goes into the dataobject. There are a few possible issues with it, just check out the bugs for FormBuilder to see them. For Layout, you can see my app to see how I made QuickForm layout horizontally. It's not very pretty, but I'm not sure how else to do it, honestly. Basically, you just have to check QuickForm for layout options as it does the actual rendering. More tips: The preDefElements array in the DO can hold pre-defined elements of your choice for the form. The fieldLabels array in the DO is an assoc array that lets you specify the labels displayed. The key is the field name and the value is the label. The fieldsToRender array in the DO is an array which tells FormBuilder which fields to render. Be careful when using this with preDefOrder. See the bugs for FormBuilder to see why. The preGenerateForm() method in a DO can do things like change the values of fields or set up additional fields or put things in preDefOrder. postGenerateForm(&$form) in the DO can alter the form (add / remove / change elements and look & feel). preProcess(&$values) in the DO is called just before FormBuilder processes the form (sets values, inserts, updates, etc.). You can alter the data that is passed in, etc. postProcess(&$values) in the DO is called just after FormBuilder processes the form. Hope that all helps. Perhaps Markus should put this (or something like it) in the docs for FB. -- paperCrane <Justin Patrin>

« previous php.pear.general (#12782) next »