Re: DB_DataObject_FormBuilder: linked table fields as select boxes

From: Date: Thu, 26 Feb 2004 00:51:56 +0000
Subject: Re: DB_DataObject_FormBuilder: linked table fields as select boxes
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10943@lists.php.net to get a copy of this message
Suat Imam-Oglu wrote:
Justin Patrin schrieb:
Suat Imam-Oglu wrote:
Hi all, how do I let FormBuilder show linked table fields as select boxes? In the example from CVS, the form elements for Manufacturer_ID and Category_ID on the products-form should be select boxes, but I get simple text input elements. I've not touched the two ini files (formbuilder.ini and formbuilder.links.ini). Should the select boxes not be autogenerated if the .links.ini exist? Am I missing something? Any help appreciated. PEAR-packages: - DB_DataObject-1.5.3 - HTML_QuickForm-3.2.1 - DB_DataObject_FormBuilder CVS-version (FormBuilder.php,v 1.22 2004/02/09) Thanks Suat
The select boxes are only generated for fields which are set up as links in the db.links.ini file. Check the links.ini section of the DB_DataObject docs. http://pear.php.net/manual/en/package.database.db-dataobject.intro-relations.php
Justin, thanks for your reply. And yes, I know. Actually I have the formbuilder.links.ini file in the correct place ("formbuilder" is the database-name). The fields are set up as links but the select boxes are not generated. Here's the content of the formbuilder.links.ini file (which I didn't change, it's the original files' content as in cvs): --------8<--------- ; This file defines relations between your tables. This is needed for ; automatic combobox building, auto-joins and more. Always keep it up-to-date. ; Format is pretty straightforward: ; [tablename] ; fieldname = targetTableName:targetFieldName [product] manufacturer_ID = manufacturer:manufacturer_id category_ID = category:category_id --------8<--------- Thus, I was wondering if I had missed something. Let me ask the question differently: What exactly do I have to do if I want select boxes for some fields in a form? Is it enough to just set up a db.links.ini file? Will this be enough to get autogenerated select boxes? Need something else? Thanks Suat
The db.links.ini file is all you need. Perhaps it isn't in the right directory? In my setup, the db.ini and db.links.ini are in the same directory as the generated DataObject class files. You can also have a db.formBuilder.ini file for table specific formBuilder options as well. :-) -- paperCrane <Justin Patrin>

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