5 Dec 2006 02:56
Radio buttons in Turba, how?
Eric <spamsink <at> scoot.netis.com>
2006-12-05 01:56:20 GMT
2006-12-05 01:56:20 GMT
Good evening, all...
I need to add some mutually-exclusive radio buttons to my Turba
address book using a MySQL backend.
In the mailing list archives I have found one example that the
article writer said resulted in an error message:
$attributes['primaryLocation'] = array(
'label' => _("Primary Location"),
'type' => 'radio',
'required' => false,
'params' => array('Home', 'Work')
);
The error that he cited was "Warning: Invalid argument supplied for
foreach() in /usr/home2/hordexp/lib/Form/Renderer.php on line 747.".
That's all I was able to find in the archives.
So, as regards radio buttons, how are they stored in the MySQL
database? In the "primaryLocation" example above, what data type is
primaryLocation? Is it a text field where the values can hold the
text strings "Home" or "work"? Or is it a numeric field that holds 0
for Home, or 1 for Work?
Using the above example for "primaryLocation", will my display show
two radio buttons, one labeled Home and the other labeled Work? If I
change 'params' to read
(Continue reading)
Now, suppose I have...
'params' => array(array('Bill', 'Chris', 'Eric'))
I get three mutually-exclusive radio buttons marked Bill, Chris, and
Eric. So far so good. I select Eric and hit Save, then on the next
screen I get "Address book entry added" followed by a list of the
entries including "Eric" in the right place.
Again, so far so good.
Then I hit "My Address Book", and instead of "Eric" in the proper
place, I get the number 2. That is correct ("Chris" would be 1, and
"Bill" would be zero). But, how do I get it to show Bill, Chris, or
Eric there instead of 0, 1, or 2? How do I set it up so that I can
search on Eric for that field, and not on the number 2
I have tried all of this with the applicable MySQL field set to an
int, and to a varchar(20). It seems to work the same either way.
Thanks...
RSS Feed