TO DO
This section is incomplete and will be concluded as soon as possible.1 Catalogued SQL
2 Javascript functions
3 Globals
4 Form events
Allows to execute logic by form level.
Event type | Execut JS when... |
---|---|
Before Input | Click on the button which has reset form function. |
Before Insert | Click on insert register button before executing INSERT sentence. |
Before Update | Click on modify button register before executing UPDATE sentence. |
Before Delete | Click on delete button register before executing DELETE sentence. |
On Load | Browser loads the form. |
On Unload | Focus leaves the page (which contains the form). |
5 Field events
Allows to execute logic to level all fields of the forms.
It is needed to indicate the field where JS has been executed when the event has done.
Event type | Executes JS when... |
---|---|
Reset | Click button used to reset the form. |
On Focus | Focus enters on the field. |
On Blur | Focus leaves the field. |
On Change | Focus leaves the field and value is modified. |
On Click | Click on field. |
6 Field format
In this section is explained how to format, real time, user input in a form field. As a user types something into an input field the value will be adjusted automatically, adding things like punctuation and dashes or removing unexpected characters.
This approach can greatly facilitate users when entering form data. It makes the process easier, minimizes errors, gives feedback, and generally improves the user experience.
6.1 Implementation
To begin with, field format is handled by the Field attributes
(wic_jdic_colattr) entity.
In first place, it must be considered that Axional Studio Forms automatically apply right space trimming.
On second hand, changing the word-casing is managed by the attribute Letter case
from the mentioned Field attributes
settings.
On third place, more complex formats are achieved by implementing a piece of script named format function
.
6.1.1 Format function
Format functions are implement in Javascript language.
Code reuse
The definition of format functions itself allows allows code reuse by defining a function and assigning it to different columns. But sometimes the function might require input parameters which can be different depending on the form the function is invoked. In that cases, the function can be defined in Client side library repositories (wic_jrep_form_import_js) and be invoked from each format function specifying the specidic parameters for each object.
6.2 Execution
7 Field validation
TO DO
This section is incomplete and will be concluded as soon as possible.8 Actions
Form Actions can be triggered from Client Side calling the JS function executeFormAction(action_code).
executeFormAction("ACTION_REFRESH_CURSOR");
As the action is not called from a server object, some functionalities will not work when calling a form action with a JS function, like these:
- Icon and Style of the action have no sense when calling form action from Client Side
- Update mode will not work if it is "Refresh Box", in this case the "Refresh row" mode will be applied
Also, form actions will not work in these situations:
-
When an action is called from Client Side, the data will come from the closest sql statement:
- If the statement match with the adapter the call will be executed correctly
- Otherwise, if the action has references to data the call will not work because it is not known which is the closest statement
- When an action has an Iteration statement defined, it will not execute correctly
Action constraint
Like on Server Side, only actions of the current JRep Object can be executed.9 Pre-defined functions
10 Import of Javascript code
10.1 Main box
wic_jrep_form_import_js | |
---|---|
Label | Description |
Code | |
Description | File description |
Content | Javascript code |
Size | File size |
Rows | Number of rows in the code |
CRC | CRC checksum number
|
Created by | |
Date created |
|
Modified by | |
Date updated |
Actions | ||
---|---|---|
Button | Title | Notes |
BUT_GENERAR_DELTA | Generate delta | null |
10.2 Example
The following example shows how to automatically inform the email field of the employee form by entering the first and last name. To do this, a Javascript function will be defined that will be cataloged and assigned to the employees object.
To start, you have to define the javascript function that you want to import. In this case, it would be as follows:
-
Code: emailfromname
-
Description: Email from name
Definition of the function:
function emailfromname(firstname, lastname, database) { return firstname + '.' + lastname + '@' + database + '.com'; }
Once the javascript function that you want to import has been defined and selected, you must go to the section ' Events' where the sentence that will be executed by the javascript will be defined, in this case, each time the focus of the javascript is removed. the column ' firstname'.
For this, in ' Colname' you have to put ' firstname' and the definition of the event will be as follows:
var m_email = emailfromname(getFieldValue("employee.firstname"), getFieldValue("employee.lastname"),getDbms()); var m_curr_email = getFieldValue("employee.email"); if(m_curr_email===''){ setFieldValue("employee.email",m_email); }
Now in the form ' employee' if the user wants to insert a new employee.
By filling in the sections ' name' and ' last name', you will automatically receive an email, also using the database in which the form is located.
In the same way, the JavaScript function will be imported into the form ' client'. In old versions, Form only allows import one JS functions file. Current version was improved to support more than one.
In this case, in the event it will be indicated that the function is executed when the focus of the column ' surname' is removed and the sentence will be as follows:
var m_email = emailfromname(getFieldValue("customer.firstname"), getFieldValue("customer.lastname"),getDbms()); var m_curr_email = getFieldValue("customer.email"); if(m_curr_email===''){ setFieldValue("customer.email",m_email); }
Now, as in the employee form, when the ' name' and ' surname' fields are filled in, the field ' email' will automatically be informed.