Zend Form 中的 URL 助手的等效项
我有一个 zend 表单,我需要在表单上提供动态链接。 IE。用户尝试从下拉菜单中选择 ->如果所需的选项不存在,请单击相邻的链接打开另一个表单,他们可以在其中添加选项。该链接将是动态的,因为我想使用 GET 从当前表单发布一些数据(例如,已选择的国家和地区)。
我该怎么做?
I have a zend form, and I need to provide a dynamic link on the form. ie. user tries to select from drop-down -> if desired option not present, click on the adjacent link to open another form where they can add the option. The link will be dynamic because I want to post some data from the current form using GET (the country and region already selected for example).
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
IE:
与 Zend_View_Helper_Url 中的相同...
IE:
Same as in the Zend_View_Helper_Url...
您可以使用 javascript/AJAX 在客户端执行此操作 - 检测链接上的点击,收集表单数据并继续到不同的页面。如果您需要其他页面的精美 URL,则必须对服务器进行 AJAX 调用以根据表单参数获取精美 URL,
或者
使链接实际上成为提交按钮,在服务器端处理表单(检测到单击了特殊提交按钮;示例 此处)并重定向到您的其他页面。
至于渲染 Zend_Form_Element 旁边的链接,您可以通过几种方式来实现,其中之一是将其放置在标签或描述中(
setLabel()
、setDescription()< /code>),同时确保将装饰器的
escape
参数设置为false
(示例 此处)You could do this client-side using javascript/AJAX - detect clicking on the link, collect form data and continue to a different page. If you need a fancy URL of the other page, you'd have to make an AJAX call to the server to get the fancy URL based on the form parameters,
or
make the link a submit button actually, process the form server-side (detecting that the special submit button was clicked; example here) and do a redirect to your other page.
As for rendering the link next to a Zend_Form_Element, you can do this in a few ways, one of them would be placing it in the label or description (
setLabel()
,setDescription()
) while making sure to set theescape
parameter of the decorator tofalse
(example here)