Note that there are some explanatory texts on larger screens.

plurals
  1. POcreate form in head of main view template
    primarykey
    data
    text
    <p>I have a view template which contains head, menu, footer (I will call this file as main template). This template is called by other pages which have some content. I decided to add form for login into menu. My first idea was about pass form from view file which is rendered via controller into main template by parameter but I don't need show login form everytime on every page so this would't be my solution.</p> <p>I have two solution but in both I have a problem:</p> <ol> <li><p>I created form in main template with helper for form and input and button with pure html</p> <pre><code>@helper.form(routes.Application.loginPosted,'class -&gt; "navbar-form pull-right"){ &lt;input class="span2" type="text" placeholder="email" name="email"&gt; &lt;input class="span2" type="password" placeholder="passwd" name="passwd"&gt; &lt;button type="submit" class="btn btn-primary"&gt;Login&lt;/button&gt; } </code></pre> <p>and I handle it in controller as DynamicForm and want it transfor into form which represent a model for easier validation</p> <pre><code>DynamicForm requestData = form().bindFromRequest(); Form&lt;User_Login&gt; loginFormFilled = form(User_Login.class); loginFormFilled.fill(new User_Login(requestData.get("email"), requestData.get("passwd"))); </code></pre> <p>but loginFormFilled.get().email (and passwd too) is always blank and I don't understand why.</p></li> <li><p>I wanted create form in main template as a model representation but I can't write code which will be compile (it has problem with logForm I know that it is incorrect but I yet tried lots of combination but I can't create valid form)</p> <pre><code>@val logForm = new Form[User_Login] @helper.form(routes.Application.loginPosted,'class -&gt; "navbar-form pull-right"){ @helper.inputText( logForm("email") ) @helper.inputPassword( logForm("passwd") ) &lt;button type="submit" class="btn btn-primary"&gt;Login&lt;/button&gt; } </code></pre></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload