Zend 表单动态更新选项
我正在使用 zend 框架,想要创建一个 zend 表单,用户可以在其中选择(使用下拉菜单)一个国家/地区。根据国家/地区的不同,我希望第二个“区域”下拉列表中填充适当的区域。同样,根据所选区域,我想要一个要填充的城市下拉列表。在每种情况下,在选择前面的值之前,我希望下一个下拉列表为空。 我正在使用doctrine2,并希望从数据库中填充这些内容。
实现这一目标的最佳方法是什么?
I am using zend framework and want to create a zend form where the user selects (using dropdowns) a country. Depending on the country, I would like the second 'region' dropdown to populate with the appropriate regions. Again, depending on the selected region, I would like a dropdown of cities to be populated. In each case, until the preceding values has been selected, I would like the next dropdown to be empty.
I am using doctrine2 and want these to be populated from the db.
What would be the best way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为没有任何本地方法可以使用 Zend 框架来实现这一点。但是,当用户更改第一个选择框中的选项时,您可以使用 AJAX 向服务器发送请求,并使用 AJAX 调用的结果更新第二个选择框。
对于服务器端代码, http:// remysharp.com/2007/01/20/auto-populate-select-boxes-using-jquery-ajax/
I don't think there is any native way to achieve this using Zend framework. But you can use AJAX to send a request to the server when the user changes the option in the first select box and update the second select box with the results from the AJAX call.
For the server side code, http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/