Re: how to validate a ListView?

2010-12-15 Thread rolandpeng

thanks for your reply.I'd like to try your second suggestion.

But after looking into AbstractFormValidator and other related examples, I
find that in my case I don't have any FormComponet to pass to
error(FormComponent fc) after validate. 

Is there any way or examples to validate without FormComponet?


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-validate-a-ListView-tp3088381p3090249.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to validate a ListView?

2010-12-15 Thread Alexander Morozov

@Override
protected void onInitialize() {
  super.onInitialize();
  Form.findForm(this).add(new AbstractFormValidator() {

private static final long serialVersionUID = 1L;

@Override
public void validate(Form? form) {
  if (/* ... */) {
form.error(price too small);
  }
}

@Override
public FormComponent?[] getDependentFormComponents() {
  return null;
}
  });
}

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-validate-a-ListView-tp3088381p3090256.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to validate a ListView?

2010-12-15 Thread rolandpeng

That's really what I want!Thank you very much.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-validate-a-ListView-tp3088381p3090257.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to validate a ListView?

2010-12-14 Thread Alexander Morozov

You cant add IValidator to a ListView because it is not a FormComponent. You
can:
1. check ListView.getList() within Form.onSubmit() and call form.error(...)
if list is empty
2. create a form validator based on AbstractFormValidator and add it to the
form component

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-validate-a-ListView-tp3088381p3088394.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org