Dave - 2005-05-03 10:21:45 -
In reply to message 2 from Dean Mumby
Quite correct:
pass the array in a hash form, where the indeces of the array aren't numeric, and you will definately get the desired result.
The genopts function attempts to figure out whether or not an array is a has array, but it's a bit of a fudge, so there are some ways you can help it:
1) specify the "hash" key in the optional extra array that you can pass to the addinput function. The extra array holds little bits of information that pertain to particular input types. You just add it as an element of the definition array:
$foo->addinput(array(
...
"extra" => array("hash" => 0)
);
Note that I specified hash *off* -- if you don't want to give hash-style indeces for the options array, you just need to make sure that the wizard class knows that the options array is definately not a hash array -- in that case, the value of each element of the options array is used for both the visible value and the passed value in a select tag.
2) actually make the array to be a hash array (as mentioned as the original solution to the problem).
The genopts function tries to do this for you, but your milage may vary. In theory, it's simple: the numeric value of an element's key should be equal to that key. If not, then the array is a hash array. This idea of mine, although it seems fine in theory, may not be perfect, so you may want to resort to either explicitly using a hash array, or explicitly telling the wizard class that the options array is not a hash.
hope this helps!
-d