Example usage for org.apache.wicket.markup.html.form IFormSubmittingComponent getForm

List of usage examples for org.apache.wicket.markup.html.form IFormSubmittingComponent getForm

Introduction

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

Prototype

Form<?> getForm();

Source Link

Document

Returns the form this component submits.

Usage

From source file:com.premiumminds.webapp.wicket.behaviours.EnableSubmitOnEnterBehaviour.java

License:Open Source License

private static IFormSubmitter findSubmitButton(final Form<?> form) {
    IFormSubmittingComponent submittingComponent = form.visitChildren(IFormSubmittingComponent.class,
            new IVisitor<Component, IFormSubmittingComponent>() {
                public void component(final Component component, final IVisit<IFormSubmittingComponent> visit) {
                    // Get submitting component
                    final IFormSubmittingComponent submittingComponent = (IFormSubmittingComponent) component;
                    final Form<?> formFromComponent = submittingComponent.getForm();

                    if ((formFromComponent != null) && (formFromComponent == form)) {
                        visit.stop(submittingComponent);
                    }//from   w ww  .  j a  v a 2 s.  com
                }
            });

    return submittingComponent;
}

From source file:com.servoy.j2db.server.headlessclient.dataui.StripHTMLTagsConverter.java

License:Open Source License

public static String getTriggerJavaScript(IFormSubmittingComponent component, String value) {
    ServoyForm form = (ServoyForm) component.getForm();
    StringBuffer sb = new StringBuffer(100);
    sb.append("javascript:document.getElementById('"); //$NON-NLS-1$
    sb.append(form.getHiddenField());//from  w  ww .  ja  va  2  s.c o  m
    sb.append("').name=\'"); //$NON-NLS-1$
    sb.append(component.getInputName());
    sb.append("';"); //$NON-NLS-1$
    sb.append("document.getElementById('"); //$NON-NLS-1$
    sb.append(form.getHiddenField());
    sb.append("').value=\'"); //$NON-NLS-1$
    sb.append(Utils.stringReplace(value, "\'", "\\\'")); //$NON-NLS-1$ //$NON-NLS-2$
    sb.append("';"); //$NON-NLS-1$

    sb.append("var f=document.getElementById('"); //$NON-NLS-1$
    sb.append(form.getJavascriptCssId());
    sb.append("');"); //$NON-NLS-1$

    sb.append("if (f.onsubmit != undefined) { if (f.onsubmit()==false) return false; }"); //$NON-NLS-1$

    sb.append("f.submit();return false;"); //$NON-NLS-1$
    return sb.toString();
}

From source file:org.artifactory.common.wicket.component.panel.titled.TitledActionPanel.java

License:Open Source License

/**
 * Adds a button to the buttons list and marks the button as the default.
 *
 * @param button The button to add and mark as default.
 *///from ww  w  . ja va 2 s.c o  m
protected void addDefaultButton(IFormSubmittingComponent button) {
    addButton((Component) button);
    button.getForm().add(new DefaultButtonBehavior(button));
}