cakephp droplist/form - xml 和 ajax
我对 Cakephp 完全是菜鸟 - 这里是...
我有一个使用 Cakephp 框架设置的网站。我想创建两个下拉表单来比较/显示数据。当用户从任一表单的下拉列表中选择一个项目时,它将在网站上显示以下内容。
我认为这些数据需要存储在 xml 文件中。如何在 Cakephp 中使用 xml 数据创建和同步两个下拉表单?表单所在的页面是视图(.ctp) 文件。
谢谢
I'm complete noob in Cakephp - here goes...
I have a website set up with Cakephp framework. I would like to create two dropdown forms to compare/show data. When the user selects an item from the dropdown from either one of the forms it is to show the content below on website.
I was thinking this data would need to be stored in an xml file. How do I create and sync two dropdown forms with xml data within Cakephp? The page the form is on is the view(.ctp) file.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要查看在线 CakePHP 文档,特别是 Ajax 帮助器周围的区域 - 即observeForm 和observeField 方法。
我不久前编写了一个应用程序,需要在用户更改下拉菜单时精确地改变屏幕上的内容(但是,我没有使用 XML)。我基本上所做的是使用 ajax 助手来观察下拉列表,然后在观察到值更改后更新包含相应下拉列表的 div。
关于 XML,您需要查找的主题是“数据源”。然而,从您原来的帖子中,我无法判断您的意思是 XML 是一项要求,还是您所预见的最佳解决方案。无论数据来自何处,您都可以“同步”并播放下拉列表中的值 - 它不一定是静态文件。
You'll probably want to have a look at the online CakePHP docs, particularly on the areas around the Ajax helper - i.e. the observeForm and observeField methods.
I wrote an app a little while ago that needed precisely to vary content around the screen when the user changes dropdowns (however, I didn't use XML though). What I basically did was use the ajax helper to observe the dropdowns and then update the divs which contained the corresponding dropdowns, once a value change has been observed.
With regards to the XML, the topic you will need to look up is "Datasources". However, from your original post, I can't tell whether you mean that XML is a requirement, or just what you foresee as the best solution. You can 'sync' and play about the values inside dropdowns regardless of where the data comes from - it doesn't have to be a static file.