Search in sources :

Example 1 with IFormSubmittingComponent

use of org.apache.wicket.markup.html.form.IFormSubmittingComponent in project wicket by apache.

the class AjaxFormSubmitBehavior method updateAjaxAttributes.

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
    super.updateAjaxAttributes(attributes);
    Form<?> form = getForm();
    attributes.setFormId(form.getMarkupId());
    String formMethod = form.getMarkupAttributes().getString("method");
    if (formMethod == null || "POST".equalsIgnoreCase(formMethod)) {
        attributes.setMethod(Method.POST);
    }
    if (form.getRootForm().isMultiPart()) {
        attributes.setMultipart(true);
        attributes.setMethod(Method.POST);
    }
    IFormSubmittingComponent submittingComponent = getFormSubmittingComponent();
    if (submittingComponent != null) {
        String submittingComponentName = submittingComponent.getInputName();
        attributes.setSubmittingComponentName(submittingComponentName);
    }
}
Also used : IFormSubmittingComponent(org.apache.wicket.markup.html.form.IFormSubmittingComponent)

Example 2 with IFormSubmittingComponent

use of org.apache.wicket.markup.html.form.IFormSubmittingComponent in project wicket by apache.

the class AjaxFormSubmitBehavior method getFormSubmittingComponent.

/**
 * @return the bound component if it implements {@link org.apache.wicket.markup.html.form.IFormSubmittingComponent},
 * otherwise - {@code null}
 */
private IFormSubmittingComponent getFormSubmittingComponent() {
    IFormSubmittingComponent submittingComponent = null;
    Component component = getComponent();
    if (component instanceof IFormSubmittingComponent) {
        submittingComponent = ((IFormSubmittingComponent) component);
    }
    return submittingComponent;
}
Also used : IFormSubmittingComponent(org.apache.wicket.markup.html.form.IFormSubmittingComponent) IFormSubmittingComponent(org.apache.wicket.markup.html.form.IFormSubmittingComponent) Component(org.apache.wicket.Component)

Example 3 with IFormSubmittingComponent

use of org.apache.wicket.markup.html.form.IFormSubmittingComponent in project wicket by apache.

the class FormTester method setValue.

/**
 * Simulates filling in a field on a <code>Form</code>.
 *
 * @param formComponentId
 *            relative path (from <code>Form</code>) to the selectable
 *            <code>FormComponent</code> or <code>IFormSubmittingComponent</code>
 * @param value
 *            the field value
 * @return This
 */
public FormTester setValue(final String formComponentId, final String value) {
    Component component = workingForm.get(formComponentId);
    Assert.assertNotNull("Unable to set value. Couldn't find component with name: " + formComponentId, component);
    return setValue(component, value);
}
Also used : FormComponent(org.apache.wicket.markup.html.form.FormComponent) AbstractTextComponent(org.apache.wicket.markup.html.form.AbstractTextComponent) Component(org.apache.wicket.Component) IFormSubmittingComponent(org.apache.wicket.markup.html.form.IFormSubmittingComponent)

Example 4 with IFormSubmittingComponent

use of org.apache.wicket.markup.html.form.IFormSubmittingComponent in project wicket by apache.

the class Wizard method onBeforeRender.

@Override
protected void onBeforeRender() {
    super.onBeforeRender();
    Component buttonBar = form.get(BUTTONS_ID);
    if (buttonBar instanceof IDefaultButtonProvider) {
        IFormSubmittingComponent defaultButton = ((IDefaultButtonProvider) buttonBar).getDefaultButton(wizardModel);
        form.setDefaultButton(defaultButton);
    }
}
Also used : IFormSubmittingComponent(org.apache.wicket.markup.html.form.IFormSubmittingComponent) IFormSubmittingComponent(org.apache.wicket.markup.html.form.IFormSubmittingComponent) Component(org.apache.wicket.Component)

Aggregations

IFormSubmittingComponent (org.apache.wicket.markup.html.form.IFormSubmittingComponent)4 Component (org.apache.wicket.Component)3 AbstractTextComponent (org.apache.wicket.markup.html.form.AbstractTextComponent)1 FormComponent (org.apache.wicket.markup.html.form.FormComponent)1