You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Will Jaynes <wj...@gmail.com> on 2009/02/15 23:14:59 UTC
inmethod datagrid, validation, and feedback
The examples for an editable inmethod datagrid show how to add validation
when adding a new column. The "firstName" and "lastName" components are
required. (component.setReqired(true)) And, indeed, if one edits a first
name and blanks it out and press the "save" icon, the row is not updated.
But no feedback is shown. I can see in the debug messages, when the
WebSession goes to clean up the feedback messages, that there are messages
that haven't been displayed. So we know that the validation works and
produces error messages, but the Ajax nature of the datagrid row edit
doesn't allow for the display of the error messages.
So, how would one show those error messages? And where would such code get
hooked in?
Will
Re: inmethod datagrid, validation, and feedback
Posted by Will Jaynes <wj...@gmail.com>.
On Sun, Feb 15, 2009 at 10:40 PM, Timo Rantalaiho <Ti...@ri.fi>wrote:
> On Sun, 15 Feb 2009, Will Jaynes wrote:
> > So, how would one show those error messages? And where would such code
> get
> > hooked in?
>
> I'm not sure about the place but basically you have to add a
> FeedbackPanel and update it in the ajax event that causes
> the error,
>
> final Component feedback = new FeedbackPanel("feedback")
> .setOutputMarkupPlaceHolder(true);
> add(feedback);
> ...
> @Override protected void onSubmit(AjaxRequestTarget target) {
> target.addComponent(feedback);
> ...
> }
>
> Best wishes,
> Timo
AH, yes. Thanks. And the place to do it is in the SubmitCancelColumn :
columns.add(new SubmitCancelColumn("esd", new Model("Edit"))
{
@Override
protected void onError(AjaxRequestTarget target, IModel
rowModel, WebMarkupContainer rowComponent)
{
target.addComponent(feedback);
super.onError(target, rowModel, rowComponent);
}
});
Re: inmethod datagrid, validation, and feedback
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Sun, 15 Feb 2009, Will Jaynes wrote:
> So, how would one show those error messages? And where would such code get
> hooked in?
I'm not sure about the place but basically you have to add a
FeedbackPanel and update it in the ajax event that causes
the error,
final Component feedback = new FeedbackPanel("feedback")
.setOutputMarkupPlaceHolder(true);
add(feedback);
...
@Override protected void onSubmit(AjaxRequestTarget target) {
target.addComponent(feedback);
...
}
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org