use of org.olat.core.gui.components.form.flexible.impl.elements.TextBoxListElementComponent in project openolat by klemens.
the class TextBoxListRenderer method renderEnabledMode.
/**
* renders the component in Enabled / editable mode
*
* @param tblComponent
* the component to render
* @param sb
* the StringOutput
* @param translator
*/
private void renderEnabledMode(TextBoxListComponent tblComponent, StringOutput sb, Translator translator) {
TextBoxListElementImpl te = ((TextBoxListElementComponent) tblComponent).getTextElementImpl();
Form rootForm = te.getRootForm();
String dispatchId = tblComponent.getFormDispatchId();
String initialValue = tblComponent.getItemsAsString();
sb.append("<input type='text' id='textboxlistinput").append(dispatchId).append("'").append(" name='textboxlistinput").append(dispatchId).append("'");
if (te.hasFocus()) {
sb.append(" autofocus");
}
sb.append(" value='").append(initialValue).append("'");
Translator myTrans = Util.createPackageTranslator(this.getClass(), translator.getLocale());
sb.append(" placeholder='").append(Formatter.escapeDoubleQuotes(myTrans.translate("add.enter"))).append("' class='o_textbox'/>\n");
String o_ffEvent = FormJSHelper.getJSFnCallFor(rootForm, dispatchId, 2);
// generate the JS-code for the bootstrap tagsinput
sb.append(FormJSHelper.getJSStart()).append("jQuery(function(){\n").append(" jQuery('#textboxlistinput").append(dispatchId).append("').tagsinput({\n");
if (tblComponent.getProvider() != null) {
sb.append(" typeahead: {\n").append(" source: function() {").append(" return jQuery.getJSON('").append(tblComponent.getMapperUri()).append("');").append(" }").append(" }\n");
}
sb.append(" });\n").append(" jQuery('#textboxlistinput").append(dispatchId).append("').on('itemAdded itemRemoved',function(event) {\n").append(o_ffEvent).append(";\n").append(" });\n").append("});\n").append(FormJSHelper.getJSEnd());
}
use of org.olat.core.gui.components.form.flexible.impl.elements.TextBoxListElementComponent in project OpenOLAT by OpenOLAT.
the class TextBoxListRenderer method renderEnabledMode.
/**
* renders the component in Enabled / editable mode
*
* @param tblComponent
* the component to render
* @param sb
* the StringOutput
* @param translator
*/
private void renderEnabledMode(TextBoxListComponent tblComponent, StringOutput sb, Translator translator) {
TextBoxListElementImpl te = ((TextBoxListElementComponent) tblComponent).getTextElementImpl();
Form rootForm = te.getRootForm();
String dispatchId = tblComponent.getFormDispatchId();
String initialValue = tblComponent.getItemsAsString();
sb.append("<input type='text' id='textboxlistinput").append(dispatchId).append("'").append(" name='textboxlistinput").append(dispatchId).append("'");
if (te.hasFocus()) {
sb.append(" autofocus");
}
sb.append(" value='").append(initialValue).append("'");
Translator myTrans = Util.createPackageTranslator(this.getClass(), translator.getLocale());
sb.append(" placeholder='").append(Formatter.escapeDoubleQuotes(myTrans.translate("add.enter"))).append("' class='o_textbox'/>\n");
String o_ffEvent = FormJSHelper.getJSFnCallFor(rootForm, dispatchId, 2);
// generate the JS-code for the bootstrap tagsinput
sb.append(FormJSHelper.getJSStart()).append("jQuery(function(){\n").append(" jQuery('#textboxlistinput").append(dispatchId).append("').tagsinput({\n");
if (tblComponent.getProvider() != null) {
sb.append(" typeahead: {\n").append(" source: function() {").append(" return jQuery.getJSON('").append(tblComponent.getMapperUri()).append("');").append(" }").append(" }\n");
}
sb.append(" });\n").append(" jQuery('#textboxlistinput").append(dispatchId).append("').on('itemAdded itemRemoved',function(event) {\n").append(o_ffEvent).append(";\n").append(" });\n").append("});\n").append(FormJSHelper.getJSEnd());
}
Aggregations