Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
...
public abstract java.lang.String renderTemplate(org.joget.apps.form.model.FormData formData, java.util.Map dataModel)
HTML template for front-end UI.
Parameters:
public org.joget.apps.form.model.FormRowSet formatData(org.joget.apps.form.model.FormData formData)
Method that retrieves loaded or submitted form data, and formats it for a store binder. The formatted data is to be stored and returned in a FormRowSet.
public org.joget.apps.form.model.FormData formatDataForValidation(org.joget.apps.form.model.FormData formData)
...
Error message can display with following code:
String id = FormUtil.getElementParameterName(this);
formData.addFormError(id, "Error!!");
...
public java.lang.String render(org.joget.apps.form.model.FormData formData, java.lang.Boolean includeMetaData)
Render HTML template for UI, with option for form builder design mode. This method will call abstract method renderTemplate for rendering.
Parameters:
public java.lang.String renderErrorTemplate(org.joget.apps.form.model.FormData formData, java.util.Map dataModel)
HTML template with errors for front-end UI. This method will call abstract method renderTemplate for rendering.
Parameters:
public java.lang.String renderReadOnlyTemplate(org.joget.apps.form.model.FormData formData, java.util.Map dataModel)
Read-only HTML template for front-end UI (Not used at the moment)
Parameters:
public boolean continueValidation(org.joget.apps.form.model.FormData formData)
Flag to indicate whether or not continue validating descendent elements.
public Collection<java.lang.String> getDynamicFieldNames()
Used to create multiple form data column in database by returning extra column names.
public java.lang.Boolean hasError(org.joget.apps.form.model.FormData formData)
Flag to indicate whether or not this field has fail the validation process
public java.lang.Boolean isAuthorize(org.joget.apps.form.model.FormData formData)
Flag to indicate whether or not the current logged in user is authorized to view this field in the form.
It used property key "permission" to retrieve Form Permission plugin.
public java.util.Collection<org.joget.apps.form.model.Element> getChildren()
Retrieves all children form field element under this field
public void setChildren(java.util.Collection<org.joget.apps.form.model.Element> children)
Retrieves all children form field element under this field
public void setChildren(java.util.Collection<org.joget.apps.form.model.Element> children)
Sets form fields as children of this field
public org.joget.apps.form.model.Element getParent()
...
public org.joget.apps.form.model.FormLoadBinder getOptionsBinder()
Gets an Options Binder
public void setOptionsBinder(org.joget.apps.form.model.FormLoadBinder optionsBinder)
Sets an Options Binder
public org.joget.apps.form.model.FormStoreBinder getStoreBinder()
Gets a Store Binder
public void setStoreBinder(org.joget.apps.form.model.FormStoreBinder storeBinder)
Sets a Store Binder
public org.joget.apps.form.model.Validator getValidator()
Gets a validator
public void setValidator(org.joget.apps.form.model.Validator validator)
Sets a validator
public java.lang.String getCustomParameterName()
...
Retrieve form data rows for an array of specified primary key values.
Code Block | ||
---|---|---|
| ||
{
name : 'id',
label : '@@form.textfield.id@@',
type : 'textfield',
required : 'True',
regex_validation : '^[a-zA-Z0-9_]+$',
validation_message : '@@form.textfield.invalidId@@'
} |
Code Block |
---|
{
name:'loadBinder',
label:'@@form.subform.loadBinder@@',
type:'elementselect',
options_ajax:'[CONTEXT_PATH]/web/property/json/getElements?classname=org.joget.apps.form.model.FormLoadElementBinder',
url:'[CONTEXT_PATH]/web/property/json[APP_PATH]/getPropertyOptions',
value:'org.joget.apps.form.lib.WorkflowFormBinder',
required:'True'
} |
The value of this property will auto convert into Form Options Binder Plugin and the plugin can be retrieved by getOptionsBinder method.
Code Block |
---|
{
name : 'optionsBinder',
label : '@@form.checkbox.chooseOptionsBinder@@',
type : 'elementselect',
options_ajax : '[CONTEXT_PATH]/web/property/json/getElements?classname=org.joget.apps.form.model.FormLoadOptionsBinder',
url : '[CONTEXT_PATH]/web/property/json[APP_PATH]/getPropertyOptions'
} |
Code Block |
---|
{
name:'permission',
label:'@@form.form.permission@@',
type:'elementselect',
options_ajax:'[CONTEXT_PATH]/web/property/json/getElements?classname=org.joget.apps.form.model.FormPermission',
url:'[CONTEXT_PATH]/web/property/json[APP_PATH]/getPropertyOptions'
} |
Code Block |
---|
{
name:'storeBinder',
label:'@@form.form.storeBinder@@',
type:'elementselect',
options_ajax:'[CONTEXT_PATH]/web/property/json/getElements?classname=org.joget.apps.form.model.FormStoreElementBinder',
url:'[CONTEXT_PATH]/web/property/json[APP_PATH]/getPropertyOptions'
} |
Code Block |
---|
{
name : 'readonly',
label : '@@form.checkbox.readonly@@',
type : 'checkbox',
value : 'false',
options : [{
value : 'true',
label : ''
}]
} |
Code Block |
---|
{
name : 'readonlyLabel',
label : '@@form.checkbox.readonlyLabel@@',
type : 'checkbox',
value : 'false',
options : [{
value : 'true',
label : ''
}]
} |
Code Block |
---|
{
name : 'workflowVariable',
label : '@@form.checkbox.workflowVariable@@',
type : 'textfield'
} |
Code Block |
---|
{
name : 'value',
description : '@@form.checkbox.value.desc@@',
label : 'Default @@form.checkbox.value@@',
type : 'textfield'
} |
Following is a sample Form Field Template of a Text Field element. It is constructed using FreeMaker syntax. This template will be used and returned by renderTemplate method.
Code Block | ||
---|---|---|
| ||
@Override
public String renderTemplate(FormData formData, Map dataModel) {
String templateName = "textField.ftl";
// set value
String value = FormUtil.getElementPropertyValue(this, formData);
dataModel.put("value", value);
String html = FormUtil.generateElementHtml(this, formData, templateName, dataModel);
return html;
} |
Code Block | ||
---|---|---|
| ||
<div class="form-cell" ${elementMetaData!}>
<label class="label">
${element.properties.label} <span class="form-cell-validator">${decoration}</span>
<#if error??>
<span class="form-error-message">${error}</span>
</#if>
</label>
<#if (element.properties.readonly! == 'true' && element.properties.readonlyLabel! == 'true') >
<div class="form-cell-value"><span>${value!?html}</span></div>
<input id="${elementParamName!}" name="${elementParamName!}" type="hidden" value="${value!?html}" />
<#else>
<input id="${elementParamName!}" name="${elementParamName!}" type="text" size="${element.properties.size!}" value="${value!?html}" maxlength="${element.properties.maxlength!}" <#if error??>class="form-error-cell"</#if> <#if element.properties.readonly! == 'true'>readonly</#if> />
</#if>
</div> |
${elementMetaData!} need to put in the ".form-cell" div. It is used by Form Builder.