List of usage examples for org.apache.wicket.markup.html.form.validation FormComponentFeedbackIndicator setIndicatorFor
public void setIndicatorFor(final Component component)
From source file:nl.knaw.dans.common.web.template.AbstractCommonForm.java
License:Apache License
/** * Add a FormComponent and FormComponentFeedbackIndicator. A red star will show at * * <pre>/*from www. ja v a 2s.c o m*/ * <span wicket:id="[formComponent.id]-feedback">feedback</span> * </pre> * * where [formComponent.id] is the id of <code>formComponent</code>. * <p/> * The FormComponent itself is at * * <pre> * <input id="tagId" wicket:id="[formComponent.id]" type="text"/> * </pre> * * @param formComponent * FormComponent to add * @param label * label used in feedback messages */ protected void add(final FormComponent formComponent, final IModel label) { // Add the component to the form super.add(formComponent); // Set its label formComponent.setLabel(label); // Add feedback panel to display FormComponentFeedbackIndicator feedbackIndicator = new FormComponentFeedbackIndicator( formComponent.getId() + SEPARATOR + FEEDBACK); feedbackIndicator.setIndicatorFor(formComponent); // LOGGER.debug("FeedbackIndicator " + feedbackIndicator.getId() + " added to the form " + this.getId()); feedbackIndicator.setOutputMarkupId(true); super.add(feedbackIndicator); }