Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates 播放模板don';t计算以开头的变量@_Templates_Scala_Playframework - Fatal编程技术网

Templates 播放模板don';t计算以开头的变量@

Templates 播放模板don';t计算以开头的变量@,templates,scala,playframework,Templates,Scala,Playframework,您好,我将首先介绍我的代码 @defining("addPostForm"){formId => @main("Add a blog post.") { <h1>Add a blog post</h1> @errors @form(routes.Application.addPost, 'id -> "@formId") { @inputText(name = "content", required = true)

您好,我将首先介绍我的代码

@defining("addPostForm"){formId =>
@main("Add a blog post.") {
    <h1>Add a blog post</h1>

    @errors

    @form(routes.Application.addPost, 'id -> "@formId") {
        @inputText(name = "content", required = true)
        <input type="submit" value="Create">
    }

    <script type="text/javascript">
        $("#@formId").validator();
    </script> 
}
}
@defining(“addPostForm”){formId=>
@main(“添加博客帖子”){
添加博客帖子
@错误
@表单(routes.Application.addPost,'id->“@formId”){
@inputText(name=“content”,required=true)
}
$(“#@formId”).validator();
}
}
为什么@form中的@fromId不能通过play进行评估?这是生成的html页面的一个片段

<form action="/addPost" method="POST" id="@formId">

但是在页面的后面,它可以正常工作,因为这是生成的

<script type="text/javascript">
    $("#addPostForm").validator();
</script> 

$(“#addPostForm”).validator();

我认为它不起作用,因为您已经在Scala代码部分,请尝试以下方法:

    @form(routes.Application.addPost, 'id -> formId)

后面的代码没有包含在代码部分中,因此它可以按预期工作。

这是我第一次尝试,但遗憾的是无法编译。“)”应为,但找到了“@”。我编辑了答案,尝试以下内容:
@form(routes.Application.addPost,(“id”,formId)){
非常感谢这项工作
@form(routes.Application.addPost,(Symbol(“id”),formId)){
感谢“Symbol”,我编辑了答案供其他读者阅读;-):)我刚刚得到了一个惊喜,那就是删除了@Alway。这很好用@form(routes.Application.addPost,'id->formId)