Search in sources :

Example 6 with ServoyForm

use of com.servoy.j2db.server.headlessclient.ServoyForm in project servoy-client by Servoy.

the class StripHTMLTagsConverter method getTriggerJavaScript.

public static String getTriggerJavaScript(IFormSubmittingComponent component, String value) {
    ServoyForm form = (ServoyForm) component.getForm();
    StringBuilder sb = new StringBuilder(100);
    // $NON-NLS-1$
    sb.append("javascript:document.getElementById('");
    sb.append(form.getHiddenField());
    // $NON-NLS-1$
    sb.append("').name=\'");
    sb.append(component.getInputName());
    // $NON-NLS-1$
    sb.append("';");
    // $NON-NLS-1$
    sb.append("document.getElementById('");
    sb.append(form.getHiddenField());
    // $NON-NLS-1$
    sb.append("').value=\'");
    // $NON-NLS-1$ //$NON-NLS-2$
    sb.append(Utils.stringReplace(value, "\'", "\\\'"));
    // $NON-NLS-1$
    sb.append("';");
    // $NON-NLS-1$
    sb.append("var f=document.getElementById('");
    sb.append(form.getJavascriptCssId());
    // $NON-NLS-1$
    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;");
    return sb.toString();
}
Also used : ServoyForm(com.servoy.j2db.server.headlessclient.ServoyForm)

Aggregations

ServoyForm (com.servoy.j2db.server.headlessclient.ServoyForm)6 PrependingStringBuffer (org.apache.wicket.util.string.PrependingStringBuffer)2 MainPage (com.servoy.j2db.server.headlessclient.MainPage)1 WicketEvent (com.servoy.j2db.server.headlessclient.eventthread.WicketEvent)1 Page (org.apache.wicket.Page)1