zend框架和jquery-从服务器端附加事件? [英] zend framework and jquery - attach event from server side?

查看:72
本文介绍了zend框架和jquery-从服务器端附加事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Zend_Form(或现在是Zend_JQuery_Form)创建的表单.

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).

是否可以从服务器端指定"更改"事件代码?还是自己写 jquery 客户端?

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

谢谢.

推荐答案

是.可以在服务器端本身中添加.创建表单元素时,添加onchange事件的详细信息,如下所示.

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'
));

这篇关于zend框架和jquery-从服务器端附加事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆