Example usage for org.apache.wicket.markup.html.form.validation FormComponentFeedbackIndicator FormComponentFeedbackIndicator

List of usage examples for org.apache.wicket.markup.html.form.validation FormComponentFeedbackIndicator FormComponentFeedbackIndicator

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form.validation FormComponentFeedbackIndicator FormComponentFeedbackIndicator.

Prototype

public FormComponentFeedbackIndicator(final String id) 

Source Link

Document

Constructor

Usage

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>//  w w  w  .ja  v  a2s .  c o  m
 *    &lt;span wicket:id=&quot;[formComponent.id]-feedback&quot;&gt;feedback&lt;/span&gt;
 * </pre>
 *
 * where [formComponent.id] is the id of <code>formComponent</code>.
 * <p/>
 * The FormComponent itself is at
 *
 * <pre>
 *    &lt;input id=&quot;tagId&quot; wicket:id=&quot;[formComponent.id]&quot; type=&quot;text&quot;/&gt;
 * </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);
}