You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by claym <cl...@pfd.net> on 2008/10/20 05:34:33 UTC
Recommended validation method
I'm fairly new, so help me out here...
I've got a basic "register a user" form.
I'd like to validate a couple of the fields (email, username) against the
database.
Database access provided by a @SpringBean service/dao object.
Where/how is the recommended way of doing this type of validation? In the
onSubmit? Some sort of custom validator?
Thanks!
--
View this message in context: http://www.nabble.com/Recommended-validation-method-tp20062724p20062724.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Recommended validation method
Posted by Igor Vaynberg <ig...@gmail.com>.
public class mywebpage extends webpage {
@SpringBean private Dao dao;
public mywebpage() {
add(new textfield("foo").add(new ivalidatior<string>() {
public void validate(ivalidatable<string> v) {
string value=v.getvalue();
if (!dao.valueunique(value)) {
validatable.error(new
validationerror().addmessagekey("error.unique").setvariable("value",
value));
}}):}
thats all there is to it
-igor
On Sun, Oct 19, 2008 at 8:34 PM, claym <cl...@pfd.net> wrote:
>
> I'm fairly new, so help me out here...
>
> I've got a basic "register a user" form.
>
> I'd like to validate a couple of the fields (email, username) against the
> database.
>
> Database access provided by a @SpringBean service/dao object.
>
> Where/how is the recommended way of doing this type of validation? In the
> onSubmit? Some sort of custom validator?
>
> Thanks!
> --
> View this message in context:
> http://www.nabble.com/Recommended-validation-method-tp20062724p20062724.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>