Re: Re: DOFormBuilder :: useForm problems

From: Date: Fri, 05 Nov 2004 18:45:36 +0000
Subject: Re: Re: DOFormBuilder :: useForm problems
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15366@lists.php.net to get a copy of this message
On Fri, 5 Nov 2004 19:29:21 +0100, Alexander Petri <alex.petri@gmx.de> wrote: > okay let me explain > > example one: UserRegistration > --------------------------------------------------------------------------- > table is: > ID,username, passwd, first_name, last_name, email ...... and so on > (pwd_updated as DATETIME ; userdata_updated as DATETIME) > > Form 1 (Insert) > should have two password field which compare each other (pwd and pwd repeat) > and the rest of userdata > > Form 2 (Update the Password) > the user can only reset his password (pwd and pwd repeat) > and on Update() will also update pwd_changed to 'NOW()' (but not > userdata_updated ) > > Form 3 (Update the normalUserdata) > the user can only update his normal userdata such as firstname,lastname and > so on > and on Update() will also update userdata_updated to 'NOW()' (but not > pwd_changed ) > Well, these are all fields in the DB/DO except for the second PW field, which can be virtual. Let me ask, though, why do you need 3 different forms? Why not just let the user update whatever they want in a single form? You can still update those "updated" date fields depending on that they change. This wouldn't be too hard. if you must have 3 different forms, you pretty much want to just change the fieldsToRender. You could do it with an internal option in your DO which you set before letting FB process it. Something like this: $do = DB_DataObject::factory(...); $do->mode = 'updatePassword'; $fb = DB_DataObject_FormBuilder::create($do); ... Then in the preGenerateForm method of the DO: if ($this->mode == 'updatePassword') { $this->fb_fieldsToRender = array('pass1', 'pass2'); } > example two: News with pictures > --------------------------------------------------------------------------- > table: > ID,headline.text > > Form1 (Insert) > headline, text + virtual image_upload You shouyld already have this one. :-) > > Form 2 (update) > headline, text + virtual (html which shows the picture) + virtual > image_upload For this, it should be the same as the last one. I would suggest for the "current image" instead of a virtual element, just add an static element in postGenerateForm with an img tag. You can use QF's insertElementBefore() to put it where you want it. > > --------------------------------------------------------------------------- > > so you can see there are different forms > these are the problems which i have currently to work on.. > thanks for help, so that i can get more familiar with DO & DOFB > If you havent' already read it all, I highly suggest reading all of: http://opensource.21st.de/tiki-index.php?page=Beyond+Advanced I put a lot of effort into documenting the things I've been doing with DO and FB, including the virtual fields, which you seem to have picked up. Make sure you understand everything that's going on in those examples. If you don't, please ask. :-) I'd always love to make the docs better. -- paperCrane --Justin Patrin--

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