Re: Fw: QuickForm: exportChangedValues / getDefault

From: Date: Tue, 23 Dec 2003 12:17:42 +0000
Subject: Re: Fw: QuickForm: exportChangedValues / getDefault
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9796@lists.php.net to get a copy of this message
Hello I had the same idea. Its not very handy to update every field on a table, if perhaps only one has changed. I think a new attribute in the return array of the form object for every element like changed => true or false would do the job. Marco ----- Original Message ----- From: "Aidan Lister" <aidan@virtualexplorer.com.au> To: <pear-general@lists.php.net> Sent: Tuesday, December 23, 2003 5:34 AM Subject: [PEAR] Fw: QuickForm: exportChangedValues / getDefault > Hello, > > > I'd like to propose a quickform function. > > This function would return only 'changed' values of a form. Perhaps > QuckForm::exportChangedValues. > > > The way this function would work would be as follows: > > 1) Form is created > 2) Default values are set > 3) Form is filled with data new data > 4) exportChangedValues is called > > exportChangedValues would then check the default value of each element, if > the submitted safe value does not match - then it would return that value. > > This could be coded externally, however you would require a method > QuickForm::getDefault (as opposed to setDefault). > > A quick knock-up function is below: > > function exportChangedValues () { > foreach ($form->_defaultValues as $key => $value) { > if ($form->exportValue($key) != $value) { > $arr[] = $form->exportValue($key); > } > } > > return $arr; > } > > Thanks for listening. > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

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