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);
}
}
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;
}
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);
}
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);
}
}
Aggregations