Serwis FormService pozwala na wykonywanie podstawowych operacji na formularzu. Posiada następujące funkcje:
|
FormService allows you to perform basic operations on the form. It has the following functions:
Form acceptance is invoked asynchronously. Optional functions are called after sending data from the form to the server.
Function parameters: Name Type Default value Description config Object { } Configuration of the form acceptance. The object has the following properties: - actionName (Type String) Configuration parameter actionName from the definition of the acceptance button (ACTION_ACCEPT_BUTTON) (by default: null) - scope (Type Object) Scope for optional functions after the saving specified in the success and failure properties (by default: window) - success (Type Function) Optional function performed after successful save (by default: null) - successParams (Type Object[]) An array specifying the parameters passed to the function specified in the success property (by default: [form, action] - the standard result of the success function for sending a form) - failure (Type Function) Optional function performed after a failed entry (by default: null) - failureParams (Type Object[]) An array specifying the parameters passed to the function specified in the failure property (by default: [form, action] - the standard result of the failure function for sending a form) - directAccept (Type Boolean) Specifies whether to proceed to direct acceptance of the task, with bypassing the AUTO_UPDATE execution check, jsAction, ADDITIONAL_JS_CHECK (default: false) Function result: none
mask- masks the form, preventing clicking and filling in fields. Function parameters: Name Type Default value Description message String null Information displayed in the center of the mask
Function result: none
unmask- removes the form mask allowing you to click and fill in the fields. Function parameters: none Function result: none
refreshDocuments (from version 3.2.59) - refreshes documents on the form without reloading the page. The table with the documents is refreshed in the Documents tab, the number of documents in the title of the Documents tab and the document view. Function parameters: none Function result: none
getValues– gets an object containing all the values of variables from the form in the form of a <key, value> of the form <var_id, variable_value>. Function parameters: none Function result: none Type Description Object An object containing variable values
getVariablesInfo- gets an object containing information about all variables from the form in the form of a <key, value> of the form <variable_id>, information_about_change>. Function parameters: none Function result: Type Description Object An object containing information about form variables. The object has the following properties: - editable(Type Boolean) Indicates whether the variable is editable - hidden(Type Boolean) Indicates whether the variable is hidden -readOnly(Type Boolean) Indicates whether the variable is read-only - inVariableSet(Type Boolean) Indicates that the variable is in the dynamic table showAddDocumentsFromDiscForm- displays the window for attaching documents from the disk to the process (same panel as in the Documents tab of the process). Function parameters: none Function result: none
showAddDocumentsFromArchiveForm- displays the window for attaching documents from the archive to the process (same panel as in the Documents tab of the process). Function parameters: none Function result: none showAddDocumentsFromTemplateForm- displays the document attach window using a template for the process (same panel as in the Process Documents tab). Function parameters: none Function result: none validateComboBoxes – validates all drop-down lists on the form (data chooser, list of users, list of values, etc.) and selects those lists that have incorrect values (also in dynamic tables). Allows you to perform specific actions after completing the validation depending on the response status.
Validation of drop-down lists is called asynchronously.
Function parameters: Name Type Default Value Description config Object { } Configuration of validation of drop-down lists. The object has the following properties: checkForm(Type Boolean) Specifies whether to check the requirements and restrictions on regular expressions in dropdowns (default: false) - submitMessage(Type String) Contents of the message visible during the validation of drop-down lists (default: '') - scope (Type Object) Scope for optional functions performed after validation specified in the success and failure properties (default: window) - success(Type Function) Optional function performed after validation completed successfully (default: null) - successParams(Type Object[]) An array specifying the parameters passed to the function specified in the success property (default: [form, action] - the standard result of the success function for sending the form) - failure(Type Function) Optional function performed after validation failed (default: null) - failureParams(Type Object[]) An array defining the parameters passed to the function defined in the failure (default: [form, action] - standard result of the failure function for sending the form) Function result: none insertHtml- inserts a piece of HTML code anywhere on the form. Function parameters: Name Type Default value Description html String null Part of HTML code. In order to make the inserted part of HTML code similar to the system, the following CSS classes can be used: suncode-container-underline (adds underlining), suncode-form-label (style for field label), suncode-form-gray-panel (gives the background color compatible with form, the CSS class can be added only to the div components). In addition, if you want to put the inserted code on the left side of the form, use one of the following styles: text-align: left, float: left. Similarly, the HTML code is placed on the right with the same properties, but with the right value. In addition, we can align components using the margin-left styles: Xpx and margin-right: Xpx. The HTML code can be centered using the combination of margin-left: auto and margin-right: 0. variableId String null Identifier of the form variable (process variable) against which the HTML code part is inserted. It can also be a dynamic table identifier. If the parameter is empty or there is no variable on the form with the given identifier, the HTML code part is inserted at the beginning/end of the form (depending on the parameter before) before Boolean false Indicates whether the HTML code part should be inserted before the specified form variable/dynamic table. If the variableId parameter is empty or there is no variable on the form with the given identifier, the code fragment is inserted at the beginning/end of the form, depending on the parameter value adopted. sameLine Boolean false Indicates whether the HTML code part should be inserted in the same row as the specified form variable/dynamic table. If the variableId parameter is empty or the variable with the given identifier does not exist on the form, then the value of the parameter does not matter. Function result: none hideSaveFormButton - hides the save form button. Function parameters: none Function result: none
showSaveFormButton - shows the button for saving the form. Function parameters: none Function result: none
hideShowCommentButton - (from 3.1.15) hides the button for adding a comment. Function parameters: none Function result: none
showShowCommentButton - (from 3.1.15) shows the button for adding a comment. Function parameters: none Function result: none
hideButton - (3.1.13) hides buttons with the given action names. Function parameters: Name Type Default Value Description actionName String null The name of the action (actionName) of the button. It is possible to hide many buttons at the same time - just add multiple parameters: formService.hideButton('buttona', 'buttonb');
Function result: none
showButton - (3.1.13) shows buttons with the given action names: Function parameters: Name Type Default Value Description actionName String null The name of the action (actionName) of the button. It is possible to show many buttons at the same time - just add multiple parameters: formService.showButton('buttona', 'buttonb');
Function result: none hideLabel - (3.1.24) hides the form labels with given identifiers The PWE plugin from version 2.1-SNAPSHOT dated 11/12/2015 does not change the form label identifiers. Earlier versions generate new identifiers when exporting to the new version of the package.
Function parameters: Name Type Default value Description actionName String null Label identifier. It is possible to hide multiple labels at once - just add multiple parameters: formService.hideLabel('labela', 'labelab');
Function result: none showLabel - (3.1.24) shows the form labels with given identifiers. The PWE plugin from version 2.1-SNAPSHOT dated 11/12/2015 does not change the form label identifiers. Earlier versions generate new identifiers when exporting to the new version of the package. Function parameters
Name Type Default value Description actionName String null Label identifier. It is possible to show multiple labels at once - just add multiple parameters: formService.showLabel('labela', 'labelb');
Function result: none blockAcceptance - blocks the possibility to accept the task After calling the function, the possibility of accepting the form is blocked. The acceptance buttons are grayed out (disabled: false), and when accepted by JavaScript, a message is displayed that the task can not be accepted. The mechanism does not block direct acceptance. The mechanism is implemented in JavaScript - it does not affect server acceptance. The number of acceptance blocks is counted, which means that there must be as many calls to the function to unlock the form as blocking. Function parameters: none Function result: none unblockAcceptance - unlocks the possibility of accepting the task Function parameters: none Function result: none isAcceptanceBlocked - checks whether the acceptance of the form is blocked Function parameters: none Function result: true/false if the acceptance of the form is blocked/unblocked |