Re: Re: DB_DataObject_FormBuilder

From: Date: Mon, 31 May 2004 05:37:03 +0000
Subject: Re: Re: DB_DataObject_FormBuilder
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29810@lists.php.net to get a copy of this message
If you're talking about the formbuilder overall settings, these should go in the same ini file as you main dataobject settings (where you specify the shcema path and such). Two options I've added that may not be documented are: quote_identifiers = 1 This will quote your table and column names (allowing you to use reserved words as table and column names :-). follow_links = 2 This will turn on recursive link lookups. Basically, this means that if you have a link in a field and the table it links to has a link as one of its display fields, that link will be looked up as well. This is a bit hard to explain succictly.... If you're talking about the formbuilder specific ini file that has batabase specific settings, it goes in the same place as your database.ini file and database.links.ini file. It should be named database.formBuilder.ini where database is the name of the database. It can have two kinds of options for each table. [table__order_fields] 0 = field1 1 = field2 etc. This gives ordering fields for your records. When a list of options for a link is populated, these fields will be used to order it. [table__display_fields] 0 = field1 1 = field2 etc. These are the fields that will be shown in the select box when you have a linked field. You can have as many display fields as you want. If you set a link field as a display field, the record for that field will be looked up and its display fields shown as well (see follow_link option above). I suggest you just check this option out to see how it works. :-) paperCrane <Justin Patrin> Sarah Gray wrote:
Justin, Thanks so much for the detailed info here. I haven't had time to go through it yet, but I will in the next couple of days. I have one more question though: would you mind explaining to me a bit about the .ini file (for FormBuilder) -- where it is called, what info needs to be in it, etc. ? Thanks again, s. Justin Patrin wrote:
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> -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.dev (#29810) next »