Home » Database » DB_DataObject_FormBuilder » Bug #3998
New strFields Configuration Array
Details
| Request #3998 | New strFields Configuration Array |
|---|---|
| Submitted | 2005-03-30 06:06 UTC |
| From | sdteffen at gmail dot com |
| Assigned | justinpatrin |
| Status | Wont fix |
| Package | DB_DataObject_FormBuilder |
| PHP Version | 4.3.10 |
| OS | Windows XP |
| Roadmaps | (Not assigned) |
Comments
[2005-03-30 06:06 UTC] sdteffen at gmail dot com
Description:
------------
The patch below allows FormBuilder to pre-define fields that
should be simple <input type="text" /> fields.
The behaviour is like the one of textFields or timeFields.
One application is to cast fields for date/timestamp entry
to simple input fields allowing faster data entry.
Reproduce code:
---------------
--- C:\WINDOWS\php\PEAR\DB\DataObject\FormBuilder.php Tue Mar 29 21:30:50 2005
+++ C:\WINDOWS\php\PEAR\DB\DataObject\FormBuilder-strFields.php Tue Mar 29 21:29:48 2005
@@ -466,6 +466,15 @@
* When it does, this can be dropped.
*/
var $timeFields = array();
+
+ /**
+ * A simple array of field names indicating which of the fields in a particular
+ * table/class are actually to be treated as string fields. This is an unfortunate
+ * workaround that is neccessary because the DataObject generator script does
+ * not make a difference between any other datatypes than string and integer.
+ * When it does, this can be dropped.
+ */
+ var $strFields = array();
/**
* Array to configure the type of the link elements. By default, a select box
@@ -974,7 +983,9 @@
$type = DB_DATAOBJECT_FORMBUILDER_ENUM;
} elseif (in_array($key, $this->booleanFields)) {
$type = DB_DATAOBJECT_BOOL;
- }
+ } elseif (in_array($key, $this->strFields)) {
+ $type = DB_DATAOBJECT_STR;
+ }
if (isset($this->preDefElements[$key])
&& (is_object($this->preDefElements[$key]) || is_array($this->preDefElements[$key]))) {
// Use predefined form field, IMPORTANT: This may depend on the used renderer!!
Expected result:
----------------
Being able to force e.g. date/timestamp fields to be
rendered as simple <input type="text" /> fields.
Actual result:
--------------
N/A (Request for Enhancement)
[2005-03-30 06:18 UTC] sdteffen at gmail dot com
I forgot to mention: The patch is against FormBuilder 0.13.0
[2005-03-31 06:01 UTC] sdteffen at gmail dot com
For a trained user, entering a timestamp like
"2005-04-05 20:00" is much faster than doing 10 mouseclicks
in the select-based timestamp data entry.
I'm quite happy with the select-based timestamp data entry
for a lot of forms, but some of our most-used forms have
to be optimized for data entry speed.
[2005-05-11 05:22 UTC] sdteffen at gmail dot com
Thanks a lot,
the second approach works perfectly.
But the first one doesn't - some DO internals parse
the date into an array and the text input field doesn't
know how to handle the date.
Is there any chance to get the the second approach
included in the FormBuilder documentation?