zend framework and jquery - attach event from server side?

人盡茶涼 提交于 2019-12-06 13:55:40

问题


I have a form I created with Zend_Form (or Zend_JQuery_Form now).

I have a select box in the form and I would like to do a call-back to the server when the user selects a value (to create dependent select boxes).

Is there any way to specify the "change" event code from the server side? or just to write the jquery client side myself?

Thanks.


回答1:


Yes. That is possible to add in the server side itself. While creating your form element, add the details for the onchange event like shown below.

$titleElement = $form->createElement('text', 'title', array(
'onchange' => 'alert(this.value);'
'label' => 'This is the title'
));


来源:https://stackoverflow.com/questions/7344895/zend-framework-and-jquery-attach-event-from-server-side

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!