change available checkboxes after select[html] changed - Zend Framework
Could you please help me rosolve my troubling matter. I used Zend_Form to create what I needed. However as I have relations many to many i decided to present multiple choices via checkboxes. Unfortunately range of these checkboxes depends on select field available in form.
I would like to change visible/availabe checkboxes depending on select option choosen.
I found that it should be possible to use javascript however I've got no idea how to take advantege of it in form based on Zend_Form.
Could you su开发者_StackOverflow中文版ggest possible solution?
Thank you in advance.
Kind Regards,
Add onchange
attribute to the select like this
$form->addElement('select', 'select', array(
'label' => 'select',
'multiOptions => array('zero', 'one'),
'onchange' => 'displayCheckboxes(this)'
));
After that implement a simple js function to display whatever you need
function displayCheckboxes(obj) {
// js code here
}
精彩评论