Hello I will start by presenting my code.
@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>
}
}
Why is it that the @fromId in the @form won’t be evaluated by play? This is a snippet of the generated html page.
<form action="/addPost" method="POST" id="@formId">
But later in the page it is working fine as this is generated.
<script type="text/javascript">
$("#addPostForm").validator();
</script>
I think it does not work because you already in a Scala code section, try this :
The later code is not included in a code section, so it works as expected.