[turba] Radio buttons in Turba, how?

Eric spamsink at scoot.netis.com
Mon Dec 4 17:56:20 PST 2006


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

'params' => array('Home', 'Work', 'Pub')

... do I then get three radio buttons on the display labeled Home, 
Work, and Pub, with Home=0, Work=1, and Pub=2?  Are they stored in 
MySQL as 0, 1, and 2 in a numeric field, or as "Home", "Work", "Pub" 
in a text field?

Does anyone know why the poster might have gotten the "Invalid 
argument supplied for foreach()" error message?  I didn't find an 
answer in the archives.

I did set up a test machine with a throwaway database on which I 
could test some of my wild guesses.  Tried the "primaryLocation" 
block as shown above, and got just a bare label called "Primary 
Location", with no radio buttons or labels for the buttons.

If there is some documentation I haven't found yet that describes all 
of this, I'd sure appreciate a pointer or link.

Thanks...



More information about the turba mailing list