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

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

Introduction

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

Prototype

String getInputName();

Source Link

Document

Returns the name that is unique to this component, at least within the form.

Usage

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  w w .  jav a 2s . com*/
    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.objetdirect.wickext.core.events.WickextAjaxFormSubmitBehavior.java

License:Open Source License

@Override
protected CharSequence getHandlerScript() {
    final String formId = form.getMarkupId();
    final CharSequence url = getCallbackUrl();
    StringBuilder ajaxSubmissionCall = new StringBuilder();
    ajaxSubmissionCall.append("wicketSubmitFormById('").append(formId).append("', '").append(url).append("', ");

    if (getComponent() instanceof IFormSubmittingComponent) {
        // adding the submitting component name
        IFormSubmittingComponent formComponent = ((IFormSubmittingComponent) getComponent());
        ajaxSubmissionCall.append("'").append(formComponent.getInputName()).append("' ");
    } else {/*from   w ww .  ja  v a2 s  .  c  o m*/
        ajaxSubmissionCall.append("null");
    }
    ajaxSubmissionCall.append(")");
    return ajaxSubmissionCall;
}