FormBuilder submit button keeping record open?

From: Date: Wed, 12 Oct 2005 17:02:06 +0000
Subject: FormBuilder submit button keeping record open?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21402@lists.php.net to get a copy of this message
Hey all, Have a situation here... I am working on migrating to the web from a bunch of MS Access forms. I have about everything done but one small section. In Access I had originally a "Save" and a "Save and Close" button. I am looking to duplicate the Save button, where it saves the record and yet still keeps it open for use by the user. I have been using the instructions from the PHP Developers Conference pdf file and have gotten quite a bit of use out of it. My code I use is as follows: (not pasted from code, that is on a different network, so please bear with me) $table = $_GET['table']; //get the table for auto generation $do = DB_DataObject::factory($table); If(isset($_GET['id'])) { $do->get($_GET['id']); //pull the proper record if its already set. } $builder =& DB_DataObject_FormBuilder::create($do); $form = $builder->getForm($_SERVER['REQUEST_URI']); //the problems start here: If($form->validate()) { $res = $form->process(array($builder, 'processForm'), false); /* I've omitted a few checks and other miscellaneous things. But any time I try and submit it, it creates a new record instead of loading the newly saved record. Is there any efficient way of having it save the record and reload the newly saved record? I've tried to set it up with the following code but I just can't get it to work!: */ $keycolumn = $builder->_getPrimaryKey($builder->_do); //get the primary key field $key = $do->$keycolumn; //get the newly generated key /*at this point I've not been able to get anything to work. Tried generating an entirely new form (i.e. $form2), setting the original $form to the new data (gave me errors comparing the data using = instead of LIKE?? I am at a loss as to get this to work. Anybody have any ideas? */ $form->display(); } else { $form->display(); } If anybody can help me out I'd greatly appreciate it! Thanks, Zane

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