views:

60

answers:

1

How can I get the description of a select multioptions tag in ZF?

If I do this, then I recieve the value, but a want the description

$subjectTitle = $feedbackForm->getValue('subjecttitle');

+2  A: 

Use the getDescription() method on the element, something like:

<?php
$form->getElement('element_name')->getDescription();

Edit: OK, after figuring out what you want, here's a possible solution:

<?php
$options = $form->getElement('my_select')->getMultiOptions();
// on form submition then do
$value = $form->getValue('my_select');
echo $options[$value];
robertbasic
yes, and how can I get the selected description?
lander
what do you mean by "selected description"? AFAIK 1 element has 1 description.
robertbasic
wen the user select one options, I want to now which he selected
lander
yes this is what I want, thank you
lander
you know, usually when someone provides the correct answer you accept it as the correct one -_-
robertbasic