Re: DB_DataObject_FormBuilder_QuickForm and Smarty

From: Date: Mon, 20 Dec 2004 16:24:30 +0000
Subject: Re: DB_DataObject_FormBuilder_QuickForm and Smarty
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16341@lists.php.net to get a copy of this message
Ok, thanks but, i can't change text of label that created by FormBuider. how can i do that? and i have created link but the value selectbox is ID from gender table, i would like key=gender.id and value=gender.name. I have table below:
                                      Table "public.person"
    Column      |          Type          |                       Modifiers
-----------------+------------------------+--------------------------------------------------------
id              | integer                | not null default
nextval('public.person_id_seq'::text)
first_name      | character varying(32)  | not null
last_name       | character varying(32)  |
address         | text                   |
phone           | character varying(32)  |
email           | character varying(128) |
gender_id       | integer                |
picture         | bytea                  |
company_name    | character varying(64)  |
company_address | text                   |
company_phone | character varying(32) | company_email | character varying(128) | Indexes: person_pkey primary key btree (id)
                                Table "public.gender"
Column |         Type         |                       Modifiers
--------+----------------------+--------------------------------------------------------
id     | integer              | not null default
nextval('public.gender_id_seq'::text) name | character varying(6) | Indexes: gender_pkey primary key btree (id) junk.link.ini [person] gender_id = gender:id my problem in FormBuilder are: - Create more header, eg. Person Information, Picture, Company Information - Change text label, eg. First_Name to First Name - Display uploaded picture in edit mode. - Create file upload (upload file to bytea filed) - Create more then one button My source in QuickForm: $sGender = $db->getAssoc('SELECT id, name FROM gender'); $form =& new HTML_QuickForm('Person', 'post'); $form->addElement('header', '', 'Personal Information'); $form->addElement('text', 'name', 'Name :', array('size' => 32, 'maxlength' => 32)); $form->addElement('textarea', 'address', 'Address :', array('rows' => 3, 'cols' => 25)); $form->addElement('text', 'phone', 'Phone :', array('size' => 32, 'maxlength' => 32)); $form->addElement('text', 'email', 'E-Mail :', array('size' => 32, 'maxlength' => 128)); $form->addElement('select', 'gender', 'Gender ', $sGender); $form->addElement('header', '', 'Picture'); $form->addElement('static', 'staticPicture', null, "<img src='pict.php?id=".$_REQUEST['id']."'width='170' height='212' >"); $form->addElement('file', 'picture','Load Picture '); $form->addElement('header', '', 'Company Information'); $form->addElement('text', 'companyName', 'Name :', array('size' => 32, 'maxlength' => 32)); $form->addElement('textarea', 'companyAddress', 'Address :', array('rows' => 3, 'cols' => 25)); $form->addElement('text', 'companyPhone', 'Phone :', array('size' => 32, 'maxlength' => 32)); $form->addElement('text', 'companyEmail', 'E-Mail :', array('size' => 32, 'maxlength' => 128)); $buttons[] = &HTML_QuickForm::createElement('submit', null, 'Save'); $buttons[] = &HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onClick' => "javascript:history.back(1)")); $form->addGroup($buttons, null, null, '&nbsp;', false); if ($form->validate()) { $form->freeze(); } $form->display(); how to convert them to Form Builder?? Thanks.. ----- Original Message ----- From: "Justin Patrin" <papercrane@gmail.com> To: "Muhyiddin A.M Hayat" <middink@indo.net.id> Cc: <pear-general@lists.php.net> Sent: Monday, December 20, 2004 5:18 AM Subject: Re: [PEAR] DB_DataObject_FormBuilder_QuickForm and Smarty
On Mon, 20 Dec 2004 03:00:20 +0800, Muhyiddin A.M Hayat <middink@indo.net.id> wrote:
----- Original Message ----- From: "Justin Patrin" <papercrane@gmail.com> To: "Muhyiddin A.M Hayat" <middink@indo.net.id> Cc: <pear-general@lists.php.net> Sent: Monday, December 20, 2004 2:38 AM Subject: Re: [PEAR] DB_DataObject_FormBuilder_QuickForm and Smarty
On Mon, 20 Dec 2004 02:27:00 +0800, Muhyiddin A.M Hayat <middink@indo.net.id> wrote:
Dear, How to using DB_DataObject_FormBuilder_QuickForm and Smarty?
The package is named DB_DataObject_FormBuilder. DB_DataObject_FormBuilder_QuickForm is a driver for it. Admittedly it's currently the only one, but the fact remains. You should look up using HTML_QuickForm with Smarty. There are examples with the HTML_QuickForm package.
but, how to use DB_DataObject_FormBuilder_QuickForm get value from DB_DataObject and DB_DataObject_FormBuilder_QuickForm stored that value to DB_DataObject? do you know where is can i found example like that?
This is what FormBuilder does. There is a simple example in the code source which youcan see here: http://pear.php.net/package/DB_DataObject_FormBuilder/docs/0.10.3/DB_DataObject_FormBuilder/_DB_DataObject_FormBuilder-0.10.3_FormBuilder_php.html
How to Using Lookup field in DB_DataObject_FormBuilder_QuickForm?
What do you mean by using a lookup field?
I would like to create <select> but that values from other table eg. [person] id name gender_id [gender] id name ------------------- in person form there are 1 text and 1 select, the values of select is name from gender table.
Once you set up the field correctly in your db.links.ini file this will be automatic (well, you have to set the linkDisplayFields for the gender table as well). For links: http://pear.php.net/manual/en/package.database.db-dataobject.intro-relations.php For the link display fields: http://opensource.21st.de/tiki-index.php?page=Formbuilder+configuration+options#id783256
-- Justin Patrin -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Justin Patrin -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


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