Example usage for org.apache.wicket.markup.html.form Form getMarkupAttributes

List of usage examples for org.apache.wicket.markup.html.form Form getMarkupAttributes

Introduction

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

Prototype

public final ValueMap getMarkupAttributes() 

Source Link

Document

THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.

Usage

From source file:name.martingeisse.wicket.component.stateless.StatelessAjaxFormSubmitBehavior.java

License:Apache License

@Override
protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
    super.updateAjaxAttributes(attributes);

    final Form<?> form = getForm();
    attributes.setFormId(form.getMarkupId());

    final String formMethod = form.getMarkupAttributes().getString("method");
    if (formMethod == null || "POST".equalsIgnoreCase(formMethod)) {
        attributes.setMethod(Method.POST);
    }/* w  ww .  j av  a2 s.  co m*/

    if (form.getRootForm().isMultiPart()) {
        attributes.setMultipart(true);
        attributes.setMethod(Method.POST);
    }

    if (getComponent() instanceof IFormSubmittingComponent) {
        final String submittingComponentName = ((IFormSubmittingComponent) getComponent()).getInputName();
        attributes.setSubmittingComponentName(submittingComponentName);
    }
}

From source file:org.wicketstuff.stateless.behaviors.StatelessAjaxFormSubmitBehavior.java

License:Apache License

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
    super.updateAjaxAttributes(attributes);

    Form<?> form = findForm();
    attributes.setFormId(form.getMarkupId());

    String formMethod = form.getMarkupAttributes().getString("method");
    if (formMethod == null || "POST".equalsIgnoreCase(formMethod)) {
        attributes.setMethod(Method.POST);
    }//from   w ww  .j  a v a  2  s.c  om

    if (form.getRootForm().isMultiPart()) {
        attributes.setMultipart(true);
        attributes.setMethod(Method.POST);
    }

    attributes.setPreventDefault(true);
}