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