Zend framework: zend form decorators - remove multiple <label>

I create a form element using this code:

$input_new = $this->createElement('radio', 'Stars', array(
    'label' => 'Stars',
    'Options' => array('class'=>'star {split:2}'),
    'multiOptions'=>array(
        '1'=> '',
        '2'=> '',
        '3'=> '',
        '4'=> '',
        '5'=> '',
        '6'=> ''
  );

Here is what I got:

<label for="Stars" class="optional">Stars</label>    
<label for="Stars-1"><input type="radio" name="Stars" id="Stars-1" value="1" class="star {split:2} in_line"></label><br />
<label for="Stars-2"><input type="radio" name="Stars" id="Stars-2" value="2" class="star {split:2} in_line"></label><br />
<label for="Stars-3"><input type="radio" name="Stars" id="Stars-3" value="3" class="star {split:2} in_line"></label><br />
<label for="Stars-4"><input type="radio" name="Stars" id="Stars-4" value="4" class="star {split:2} in_line"></label><br />
<label for="Stars-5"><input type="radio" name="Stars" id="Stars-5" value="5" class="star {split:2} in_line"></label><br />
<label for="Stars-6"><input type="radio" name="Stars" id="Stars-6" value="6" class="star {split:2} in_line"></label>

I want to delete both on each input and in the tag
, but the main label (Stars) still remains. How can i do this?

+3
source share
1 answer

Well, your switches can go to the display group (set of fields) so that you can remove all the shortcuts for the buttons and just use the group label. If not, you will probably have to write a decorator look. I can't think of a cleaner way to get rid of shortcuts.

[EDIT]

Here is an example:

Set the decorators on the form as follows:

$input_new->setDecorators(array(array('ViewScript', array('viewScript' => 'starsview.phtml'))));

starsview.phtml. , , script:

, .

+2

Source: https://habr.com/ru/post/1778726/


All Articles