如果条件为真,Symfony 会确认消息 (submit_to_remote)
我在 Symfony 中制作了一个基于单选按钮的表单。如果选中单选按钮,我想发出确认消息。这是我的代码,但它并不完全是我想要的:
<?php echo jq_submit_to_remote('deleteButton','Törlés', array(
'url' => 'editCategory/deleteSubmenu',
'with'=>"'value=' + getSelectedRadio()",
'condition' => 'getSelectedRadio() != undefined',
'confirm' => 'Are you sure?',
)) ?>
这在每种情况下都会产生确认消息。如何在确认中添加条件?
I made a radiobutton based form in Symfony. I'd like to make a confirm message, IF a radio button checked. This is my code, but it's not exactly what I want:
<?php echo jq_submit_to_remote('deleteButton','Törlés', array(
'url' => 'editCategory/deleteSubmenu',
'with'=>"'value=' + getSelectedRadio()",
'condition' => 'getSelectedRadio() != undefined',
'confirm' => 'Are you sure?',
)) ?>
This makes the confirm message in every case. How can I add condition to the confirm?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你无法使用 symfony 的助手来做到这一点,你需要编写自己的 JS 代码。无论如何,这是推荐的方法 - javascript 助手被弃用是有原因的。
You won't be able to do that with symfony's helpers, you'll need to write your own JS code. That's the recommended way to do it anyway - there's a reason the javascript helpers got deprecated.