Re: DB_DataObject_FormBuilder & mysql "text" type

From: Date: Thu, 25 Aug 2005 16:56:00 +0000
Subject: Re: DB_DataObject_FormBuilder & mysql "text" type
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-39563@lists.php.net to get a copy of this message
On 8/25/05, Markus Fischer <markus@fischer.name> wrote: > Hi, > > when creating a form from a DO which has columns of type "text" only a > <input type="text"> is displayed instead of a textarea. > > I tracked down that in FormBuilder.php in _generateForm() in the big > switch statement is the case: > > case ($type & DB_DATAOBJECT_STR): > > Inside it only calls _createTextArea if the string contains newlines: > > // If field content contains linebreaks, make textarea - otherwise, > standard textbox > if (isset($this->_do->$key) && strlen($this->_do->$key) && > strstr($this->_do->$key, "\n")) { > $element =& $this->_form->_createTextArea($key); > > > When we use this form for insert a new element, there's no value and > thus there's always a TextField displayed instead of a TextArea. > > The DO type is set to DB_DATAOBJECT_BLOB if it's a mysql 'text' type. > > So to me it seems that the check for DB_DATAOBJECT_BLOB would be the > properly solution (having the newline check is handy, too). > > I've not installed the latest version (0.18.1) but downloaded and > checked the source and this part seems unmodified to me. > > If my analysis is correct I hope this can be fixed soon. > This is precisely why there's the textFields option. Putting these fields in that array will cause them to be textareas. I don't think that textareas were set as blobs in the past, but I'm not absolutely sure. If this is, indeed, 100% reproducible we could also add that check. -- Justin Patrin

« previous php.pear.dev (#39563) next »