DB_dataObject_Formbuilder element types and field display order

From: Date: Sat, 25 Feb 2006 22:46:46 +0000
Subject: DB_dataObject_Formbuilder element types and field display order
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23126@lists.php.net to get a copy of this message
Hello, I'm learning how to use DB_dataObject_Formbuilder and QuickForm. My objective is allow a user to upload a picture, add some descriptions, store the metadata and tag it. I think something like Flickr, but for personal local use. I've successfully used formbuilder to generate a form for me. However, I still don't know how to accomplish a few things: - How do I tell a generated form to be certain element type for a given field? - i.e. change the default text field to a checkbox or to a enumerated type? - can I do it with Formbuilder, or QuickForm? - if with QuickForm
       - Do I need to delete the formElement, and re-add it again manually?
- How do I use QuickForm -> insertElementBefore function. For fields that I would not be using with the database. - Is there a way to reorder the fields of a formbuilder generated form? ------------------------------- My code. <?php require_once( 'config/config.php' ); require_once( 'DB/DataObject/FormBuilder.php' ); $Pictures = new DataObjects_Pictures( ); // I understand I can set the default information like so: // $Pictures->filename = "hello world"; $formBuilder = &DB_DataObject_FormBuilder::create( $Pictures ); $form = &$formBuilder->getForm( ); // If we validate, then we process it here if( $form->validate( ) ) { $form->process( array( &$formBuilder, 'processForm' ), false ); // Redirect header( "Location: http://" . $_SERVER[ 'HTTP_HOST' ] . dirname( $_SERVER[ 'PHP_SELF' ] ) . "/index.php" ); } $form->display(); ?> ------------------------------- My schema. -- -- Table structure for table pictures -- CREATE TABLE pictures ( picture_id int(11) NOT NULL auto_increment, user_id int(11) NOT NULL, filename varchar(255) NOT NULL, original longblob NOT NULL, title varchar(255) NOT NULL, description text NOT NULL, views int(11) NULL, downloads int(11) NULL, date_taken datetime NULL, date_uploaded datetime NOT NULL, sha1 binary(160) NOT NULL, PRIMARY KEY (picture_id), KEY views (views), KEY downloads (downloads), KEY sha1 (sha1), KEY user_id (user_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table tag_pic -- CREATE TABLE tag_pic ( tag_id int(11) NOT NULL, picture_id int(11) NOT NULL, user_id int(11) NOT NULL, KEY user_id (user_id), KEY picture_id (picture_id), KEY tag_id_2 (tag_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- Lloyd Leung<br/> ll@lloydleung.com<br/> <A HREF="http://www.lloydleung.com">http://www.lloydleung.com</A><br/>

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