FormBuilder <select> generation on string fields
| From: | Norbert Mocsnik | Date: | Thu, 12 Feb 2004 00:12:44 +0000 |
| Subject: | FormBuilder <select> generation on string fields | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-25594@lists.php.net to get a copy of this message | ||
Hello,
Is there a reason not to let FormBuilder populate a <select> listbox for strings? String fields may be linked to another tables also, doesn't they?
Actually FormBuilder checks only DB_DATAOBJECT_INT fields if the field is linked to a table:
case DB_DATAOBJECT_INT:
$links = $this->_do->links();
if (is_array($links) && array_key_exists($key, $links)) {
[.. <select> ..]
} else {
[.. <input type=text> ..]
}
Why not have the same for DB_DATAOBJECT_STR fields? I modified my local copy to have it this way. I have two cases when it's needed for me:
- 'userid' fields stored in my tables (string, length: 16)
- license type field: 'a', 'b', 'c' etc. (string, length: 1)
I have to link these fields to another tables where their corresponding data can be resolved. Yes, I know I could use integers instead, however, this much better fits my needs.
I'm sure there're a couple of other cases when this is useful.
Any comment on this? It's only 5 lines of code, I'm glad to post it to the list if you want..
Regards,
Norbert