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

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

Introduction

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

Prototype

public final Component setOutputMarkupId(final boolean output) 

Source Link

Document

Sets whether or not component will output id attribute into the markup.

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 . j a  v a2 s  . co 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);
}