I'm wrong, something like this would work:

$selectOptions = $this->element->getMultiOptions();
$custom = array();
foreach($selectOptions as $value => $label){
?>      
<div class="radio"><input type="radio" value="<?=$value?>"
/><?=$label?></div>
<?}?>  

The only problem with this is that you have to re write all the disable,
multiple, etc checks.


strick wrote:
> 
> The problem with this is that you still can't add information inbetween
> each <input>.  For instance:
> 
> <label for="">Mine:</label><input type="radio" />  Reference 
> <label for="">Mine:</label><input type="radio" />  Reference 
> <label for="">Mine:</label><input type="radio" />  Reference 
> 
> To accomplish this you still have to extend the formRadio view helper and
> modify.
> 
> Am I wrong?
> 
> Julian Davchev wrote:
>> 
>> This solution should work for you. It fixes two issues:
>> - attributes leaking into html..when they shouldn't
>> - you get your selects,radio,checkbox and whatever like that  working
>> 
>> 
>> <?php
>> //we need this trick due to:
>> http://framework.zend.com/issues/browse/ZF-3052
>> //Expand the list as needed
>> $attributesWhiteList = 
>> array('multiple','class','style','onClick','onChange','checked','disabled');
>> 
>> 
>> $attributes = $this->element->getAttribs();
>> $selectOptions = null;
>> if (method_exists($this->element,'getMultiOptions')) {
>>     $selectOptions = $this->element->getMultiOptions();
>> }
>> foreach ($attributes as $attrib => $value) {
>>     if (!in_array($attrib,$attributesWhiteList)) {
>>         unset($attributes[$attrib]);
>>     }
>> }
>> ?>
>> <div class="<?= $this->class ?>">
>>     <?= $this->formLabel($this->element->getName(), 
>> $this->element->getLabel()) ?>
>>     <?=
>>         $this->{$this->element->helper}(
>>         $this->element->getName(),
>>         $this->element->getValue(),
>>         $attributes,
>>         $selectOptions
>>     ) ?>
>>     <?= $this->formErrors($this->element->getMessages()) ?>
>>     <div class="hint"><?= $this->element->getDescription() ?></div>
>> </div>
>> 
>> 
>> jmazzi wrote:
>>> I am using the example from 
>>>
>>> http://framework.zend.com/manual/en/zend.form.standardDecorators.html#zend.form.standardDecorators.viewScript
>>> to create a custom viewscript. 
>>>
>>> i used the example from the manual but it wont render select box
>>> options. It
>>> works for all other input types (text etc) and even works to create the
>>> select box. But the options do not load (addMultioptions).
>>>
>>>
>>>
>>>
>>>   
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://n4.nabble.com/Zend-Form-Viewscript-tp651615p964431.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to