Re: DB_DataObject_FormBuilder: reorderElements, preDefOrder
| From: | Mocsnik Norbert | Date: | Sat, 08 Nov 2003 15:18:33 +0000 |
| Subject: | Re: DB_DataObject_FormBuilder: reorderElements, preDefOrder | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-23353@lists.php.net to get a copy of this message | ||
I think a field that is not mentioned in $preDefOrder should be rendered into the form in no ways. However, it should be possible to set/change these fields' contents by the script itself, before processing the form. Imagine a table called "contacts" which, besides having standard data fields such as name and address, has a "userid" and a "timestamp" field and they should not be rendered into the form, they are for internal use (userid stores the user id of the record "owner"). When posting a form, the user script has to set the contents of these fields (if needed) so, in my opinion, we don't have to deal with processForm() this time.
Markus Wolff wrote:
Mocsnik Norbert wrote:Is there a reason to check if preDefOrder contains as many fields as the DataObject itself does? If this check is left out, it is possible to use this variable for indicating which fields to render, instead of implementing one more variable ("fields_to_display") in the future. function _reorderElements() { if(isset($this->_do->preDefOrder)Hmm... so what about the other fields, then? Do you just want not to _display_ them (i.o.w.: make them "hidden") or do you want to not have them in the form at all (which would also mean that the values of these fields, if set in the dataobject, cannot be passed through the form)? CU Markus&& is_array($this->_do->preDefOrder) && count($this->_do->preDefOrder)== count($this->_do->table())) {.. In short, if I have 10 fields and I do $do->preDefOrder = array('firstfield', 'secondfield'); then I'm sure I want to display only these fields and I did not write it wrong.