I built a form class extending zend_form.I have two submitting buttons :
$like=new Zend_Form_Element_Image('vote');
$like->setImage($config->path->images."up.png")
->setValue(2);
$dislike=new Zend_Form_Element_Image('vote');
$dislike->setImage($config->path->images."down.png")
->setValue(1);
I'd want to have two submit buttons with same name and different value so that I can later access the value of the submitted one by a switch statement in the controller:
$submit = $this->_request->getPost('vote');
switch($submit) {
case 'one':
// button one was pressed
break;
case 'two':
}
}
But If I do set those with the same name the last one is overriding the first so only one button is output.
With file elements theres a method setMultifile() that does the trick.
what should I do here?
thanks
Luca
You might try using array notation for the images.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With