开发者

change available checkboxes after select[html] changed - Zend Framework

开发者 https://www.devze.com 2023-01-02 03:42 出处:网络
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. Unfortuna

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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消