Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
...
Code Block | ||
---|---|---|
| ||
import org.joget.apps.app.dao.FormDefinitionDao; import org.joget.apps.app.model.FormDefinition; import org.joget.apps.app.model.AppDefinition; import org.joget.apps.app.service.AppUtil; import org.joget.apps.form.model.Form; import org.joget.apps.form.service.FormService; AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService"); FormDefinitionDao formDefinitionDao = (FormDefinitionDao) AppUtil.getApplicationContext().getBean("formDefinitionDao"); FormService formService = (FormService) AppUtil.getApplicationContext().getBean("formService"); String id = "crm_account"; String appId = "crm"; Long appVersion = appService.getPublishedVersion(appId); AppDefinition appDef = appService.getAppDefinition(appId, appVersion.toString()); FormDefinition formDef = formDefinitionDao.loadById(formId, appDef); if (formDef != null) { //create the form Form form = (Form) formService.createElementFromJson(formDef.getJson(), true); } |
public java.lang.String PREFIX_FOREIGN_KEY = "fk_";
Prefix of a request parameter used to sets the value of a form field and change the field to a readonly field.
public java.lang.String PREFIX_FOREIGN_KEY_EDITABLE = "fke_";
Prefix of a request parameter used to sets the value of a form field but without change the field to readonly.
java.lang.String PREVIEW_MODE = "_PREVIEW_MODE";
A key to set the FormResult as preview mode.
public org.joget.apps.form.model.Element createElementFromJson(java.lang.String elementJson)
Creates an element object from a JSON definition
public org.joget.apps.form.model.Element createElementFromJson(java.lang.String elementJson, boolean processHashVariable)
Creates an element object from a JSON definition
public org.joget.apps.form.model.FormData executeFormActions(org.joget.apps.form.model.Form form, org.joget.apps.form.model.FormData formData)
Invokes actions (e.g. buttons) in the form
public org.joget.apps.form.model.FormData executeFormLoadBinders(org.joget.apps.form.model.Element element, org.joget.apps.form.model.FormData formData)
Loads data for a specific row into an element by calling all load binders in the element.
public org.joget.apps.form.model.FormData executeFormOptionsBinders(org.joget.apps.form.model.Element element, org.joget.apps.form.model.FormData formData)
Preloads data for an element, e.g. field options, etc. by calling all option binders in the element.
public org.joget.apps.form.model.FormData executeFormStoreBinders(org.joget.apps.form.model.Form form, org.joget.apps.form.model.FormData formData)
Executes store binders for a form
public java.lang.String generateElementDesignerHtml(org.joget.apps.form.model.Element element, org.joget.apps.form.model.FormData formData, boolean includeMetaData)
Generates HTML for the form element to be used in the Form Builder
public java.lang.String generateElementErrorHtml(org.joget.apps.form.model.Element element, org.joget.apps.form.model.FormData formData)
Generates error HTML for the form element
public java.lang.String generateElementHtml(org.joget.apps.form.model.Element element, org.joget.apps.form.model.FormData formData)
Generates HTML for the form element
public org.joget.apps.form.model.Form loadFormData(org.joget.apps.form.model.Form form, org.joget.apps.form.model.FormData formData)
Main method to load a form with data loaded.
public org.joget.apps.form.model.Form loadFormFromJson(java.lang.String formJson, org.joget.apps.form.model.FormData formData)
Load a form from its JSON definition, with data loaded.
public java.lang.String previewElement(java.lang.String json)
Use case to generate HTML from a JSON element definition.
public java.lang.String previewElement(java.lang.String json, boolean includeMetaData)
Use case to generate HTML from a JSON element definition.
public org.joget.apps.form.model.FormData recursiveExecuteFormStoreBinders(org.joget.apps.form.model.Form form, org.joget.apps.form.model.Element element, org.joget.apps.form.model.FormData formData)
Recursively executes all the store binders in a form
public org.joget.apps.form.model.FormData retrieveFormDataFromRequest(org.joget.apps.form.model.FormData formData, javax.servlet.http.HttpServletRequest request)
Retrieves form data submitted via a HTTP servlet request
public org.joget.apps.form.model.FormData retrieveFormDataFromRequestMap(org.joget.apps.form.model.FormData formData, java.util.Map requestMap)
Retrieves form data submitted via a HTTP servlet request parameters map
public java.lang.String retrieveFormErrorHtml(org.joget.apps.form.model.Form form, org.joget.apps.form.model.FormData formData)
Used to retrieves the form HTML when there is errors in form
Used to retrieves the Form HTML
public org.joget.apps.form.model.FormData storeElementData(org.joget.apps.form.model.Form form, org.joget.apps.form.model.Element element, org.joget.apps.form.model.FormData formData)
Store the data of a form field element
public org.joget.apps.form.model.FormData submitForm(org.joget.apps.form.model.Form form, org.joget.apps.form.model.FormData formData, boolean ignoreValidation)
Process form submission
public org.joget.apps.form.model.FormData validateFormData(org.joget.apps.form.model.Form form, org.joget.apps.form.model.FormData formData)
Validates form data submitted for a specific form
public java.lang.String viewForm(org.joget.apps.form.model.Form form, java.lang.String primaryKeyValue)
Use case to load and view a form, with data loaded
public java.lang.String viewFormFromJson(java.lang.String formJson, java.lang.String primaryKeyValue)
Use case to view a form from its JSON definition, with data loaded