I. Overview
1.1 Requirement
In FR reports, prompts indicating whether or not an operation succeeds are built in the system, for example:
After a Text widget is set to NOT NULL, if there is no input in the widget, the system will prompt that “The widget value cannot be null”;
After a Drop-down Box widget is set to not allow customization, if the content typed is not in the drop-down list, the system will prompt “Not in the list”;
In a data entry report, a prompt of “Success” will appear at the top-right corner in case of successful submission.
These prompts are simple. Sometimes we want more humanized prompts. For instance, after data entry succeeds, a prompt of “Data submitted successfully!” is expected, as shown below:
The default prompt before modification:
After modification:
1.2 Solution
Default prompts are stored in FR.i18n objects and to modify a prompt, we only need to modify the value of the key corresponding to it. For example, the key corresponding to successful data entry is FR.i18n['Fine-Engine_Report_Successfully'],, so we only need to modify it to the corresponding prompt.
II. Sample
2.1 Steps
1) Open a data entry template, for example, %FR_HOME%\webapps\webroot\WEB-INF\reportlets\demo\Data Entry\Import Excel.cpt.
2) Click [Template]> [Web Attributes]>[Data Entry Settings] and add a Loading End event, as shown below:
Input the following JavaScript codes:
FR.i18n['Fine-Engine_Report_Successfully']='Data submitted successfully!';
To modify the default prompt, you just need to find corresponding keys, with the effect shown in the figure above.
Modify common prompt objects and prompts as described above:
Key | Default value | Scenario |
FR.i18n['Fine-Engine_Basic_Loading'] | Loading | Prompt appearing when a report is loaded |
FR.i18n['Fine-Engine_Not_NULL'] | not null | A default value that cannot be null is set to a widget |
FR.i18n['Fine-Engine_Not_In_List'] | Not in the list | The value typed in the drop-down box widget is not in the list |
FR.i18n['Fine-Engine_Verify_Verify_Success'] | Validate Successfully | Validation in a data entry report succeeds |
FR.i18n['Fine-Engine_Report_Verify_Failed'] | Validation Failed | Validation in a data entry report fails |
FR.i18n['Fine-Engine_Report_Successfully'] | Success | Submission of data in a data entry report succeeds |
FR.i18n['Fine-Engine_Basic_Fail_Location'] | Fail | Submission of data in a data entry report fails |
Note
Be sure to be case-sensitive, or the modification will fail.
Additionally, to modify the prompt of a parameter bar widget, such modification should take place in an After Initialization event.
2.2 Preview
Save the template and click [Data Entry Preview]. The effect is shown below: