Checkbox value is not bound

48 views
Skip to first unread message

dirkvra...@gmail.com

unread,
Apr 16, 2013, 9:03:23 AM4/16/13
to google-s...@googlegroups.com
I'm building a registration from like this:

<html>
<body>
<form action="/user/register" method="post">
<input id="agree" type="checkbox" name="agree" value="${agree}"/> I have read and agreed BLA BLA BLA
<input type="submit" value="register"/>
</form>
</body>
</html>

In my view-class I have this:

private String firstName;
private String lastName;
private String email;
private String password;
private String passwordConfirmation;
private Boolean agree;

And the getters and setters for ALL fields!

When I set a value for first name etc it works like a charm.
But the value of 'agree' is never set on the view.

If I do not check the checkbox and submit the form, the setter is not executed. If I do check the checkbox the setter is executed with null.

I already tried to change the Boolean to a primitive boolean, but then also when I do not check the checkbox the setter is not called. When I do check the checkbox the setter is called with boolean 'false'.

I'm on version 0.8.8.

I would expect for a checkbox that the setters always will be called, not? Am I doing something wrong?

KR,

Dirk

Reply all
Reply to author
Forward
0 new messages