...
- dataModel - Model containing values to be displayed in the template.
Overridable Methods
formatData
...
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.
Utility Methods
getChildren
...
Plugin Proeprties Options
Mandatory Property
...
id
- All Form Element Field must has this property appear in the Properties Options JSON.
- This is used as unique identifier of a field in a form.
Code Block |
---|
|
{
name : 'id',
label : '@@form.textfield.id@@',
type : 'textfield',
required : 'True',
regex_validation : '^[a-zA-Z0-9_]+$',
validation_message : '@@form.textfield.invalidId@@'
} |
Predefined Property
loadBinder
- If this property appear in the Properties Options JSON, admin user is able to choose a Form Load Binder.
- The value of this property will auto convert into Form Load Binder Plugin and the plugin can be retrieved by getLoadBinder method.
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'
} |
optionsBinder
- If this property appear in the Properties Options JSON, admin user is able to choose a Form Options Binder.
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'
} |
permission
- If this property appear in the Properties Options JSON, admin user is able to choose a Form Permission.
- The value of this property will auto convert into Form Permission Plugin and the plugin is used by isAuthorize method.
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'
} |
storeBinder
- If this property appear in the Properties Options JSON, admin user is able to choose a Form Store Binder.
- The value of this property will auto convert into Form Store Binder Plugin and the plugin can be retrieved by getSoreBinder method.
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'
} |
readonly
- System use this property to flag a field a readonly.
- If this property appear in the Properties Options JSON, admin user can force this field to display as readonly.
- This value is ignored if the parent form is set to readonly
Code Block |
---|
{
name : 'readonly',
label : '@@form.checkbox.readonly@@',
type : 'checkbox',
value : 'false',
options : [{
value : 'true',
label : ''
}]
} |
readonlyLabel
- System use this property to flag a field a readonly field should display as label or not.
- If this property appear in the Properties Options JSON, admin user can force this field to display as label when it is readonly.
- This value is ignored if the parent form is set to display as label when it is readonly
Code Block |
---|
{
name : 'readonlyLabel',
label : '@@form.checkbox.readonlyLabel@@',
type : 'checkbox',
value : 'false',
options : [{
value : 'true',
label : ''
}]
} |
workflowVariable
- If this property appear in the Properties Options JSON, admin user is set to store this field value to a workflow variable.
- The value of this field will auto set to the mentioned workflow variable if the Form Store Binder is set to Workflow Form Binder.
Code Block |
---|
{
name : 'workflowVariable',
label : '@@form.checkbox.workflowVariable@@',
type : 'textfield'
} |
value
- If this property appear in the Properties Options JSON, admin user is able to set a default value for this field.
Code Block |
---|
{
name : 'value',
description : '@@form.checkbox.value.desc@@',
label : 'Default @@form.checkbox.value@@',
type : 'textfield'
} |
validator
- If this property appear in the Properties Options JSON, admin user is able to choose a Form Validator.
- The value of this property will auto convert into Form Validator Plugin and the plugin can be retrieved by getValidator method.
Form Field Element Template Sample
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> |
Explanations
Tutorials
...