Note that there are some explanatory texts on larger screens.

plurals
  1. POPlay framework 2.0 scala form error handling
    text
    copied!<p>I have a problem with form , the problem is that I can't show error in view properly(I think so). Validation works fine.</p> <p>When the old password is incorrect error message is displayed below input box on the other hand when passwords are mismatched error isn't appearing anywhere. </p> <p>If I do some debug I get data:</p> <p>from in view: <code>@pass_form("password").errors</code> </p> <p>I get this: </p> <pre><code>FormError(password,Passwords dont match,WrappedArray()) </code></pre> <p>So my question how to fix form or code in view, to print that error properly.</p> <pre><code>Form( mapping( "old_password" -&gt; text.verifying(Messages("forms.password.old.mismatch"), password =&gt; User.correct_?(user.id, password)), "password" -&gt; tuple( "new" -&gt; text(minLength = conf.getInt("password.length.min").get), "confirm" -&gt; text).verifying(Messages("forms.password.new.mismatch"), passwords =&gt; passwords._1 == passwords._2) ) ((_, password) =&gt; password._1)((_) =&gt; Some(("", ("", "")))) ) </code></pre> <p>In view I have:</p> <pre><code>@helper.form(action = routes.UserController.submitPassword) { @helper.input(pass_form("old_password")) { (id, name, value, args) =&gt; &lt;input type="password" name="@name" id="@id" @toHtmlArgs(args)&gt; } @helper.input(pass_form("password.new")) { (id, name, value, args) =&gt; &lt;input type="password" name="@name" id="@id" @toHtmlArgs(args)&gt; } @helper.input(pass_form("password.confirm")) { (id, name, value, args) =&gt; &lt;input type="password" name="@name" id="@id" @toHtmlArgs(args)&gt; } &lt;input type="submit" value="Set"&gt; } </code></pre>
 

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