I did this with an IVisitor, that traverses all form components and adds an
AbstractBehavior to each required inputfield. This Behavior writes an
"*" right after the component has been painted.
Watch this pdf for an example:
http://code.google.com/p/londonwicket/downloads/list and than "
LondonWicket-FormsWithFlair.pdf "
As "setComponentBorder" is deprecated in newer wicket versions i left the
componentBorder part out, no need for it.
For making it work with ajax, i had also to implement
AbstractBehavior.isTemporary()
and to add the forms parent as a target oft he calling button
Jerome
-Original Message-
From: Martin U [mailto:ufer.mar...@googlemail.com]
Sent: Thursday, February 04, 2010 1:14 PM
To: users@wicket.apache.org
Subject: Easier using of FormComponentFeedbackIndicator for many fields?!
Hi Folks,
i've to implement many form-pages with a lot of (more than 30) input fields,
and each of them should be validated at least of "required" or not.
but the request is to show the validation-errors behind the depeding
component.. so iam using FormComponentFeedbackIndicator now and everything
works fine with:
searchfield = new RequiredTextField("seachfield", new
PropertyModel(SearchPanel.this, "searchString"));
add(searchfield);
indicator = new FormComponentFeedbackIndicator("searchfield_indicator");
indicator.setIndicatorFor(searchfield);
indicator.setOutputMarkupId(true);
indicator.setOutputMarkupPlaceholderTag(true);
add(indicator);
this is an ajax-form so i have to add this to onSubmit too for each
validating field.
protected void onError(AjaxRequestTarget target, Form form) {
target.addComponent(indicator);
}
Is there any Hint to easier this implementation?
What i imagine is something like:
searchfield = new *RequiredValidatedTextField*("seachfield", new
PropertyModel(SearchPanel.this, "searchString"));
and inside this child class iam building a indicator
but how could i add the "indicator"-Span dynamically to the markup and how
could i do the target.addComponent than?
Thanks for any hints.
- Martin
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org