我有一个提交按钮,我想要弹出确认窗口,这样做效果很好:
<g:actionSubmit value="Delete"
action="deleteTpsReport"
onclick="return confirm('ohnoes!');"
但是当我想将确认文本移动到 messages.properties 文件中时,我尝试:
<g:actionSubmit value="Delete"
action="deleteTpsReport"
onclick="return confirm('<g:message code="tps.delete.confirmation"/>');"
这不起作用,');"
显示在页面上,并且 javascript 被完全忽略。
有没有办法嵌套这些标签,以便我可以在 actionSubmit
的事件处理程序中使用 message
?
最佳答案
这应该有效:
<g:actionSubmit value="Delete"
action="deleteTpsReport"
onclick="return confirm('${message(code: 'tps.delete.confirmation')}');"/>
关于grails - 嵌套引号 : a message tag inside a javascript fragment inside of an actionsubmit tag,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9879376/