I. Overview
1.1 Requirement
In making a report template similar to a questionnaire, there may be a couple of options, of which the last one is other. When other is picked, an input box may pop up and you are allowed to type a value in it, which will then be displayed in a certain cell, as shown below:
1.2 Solution
Add a State Change event to the Radio Button Group widget.
You will learn |
---|
|
II. Sample
2.1 Steps
1) The report is designed as follows:
2) Add a Radio Button Group Widget into B1 and configure settings for the Data Dictionary as follows:
3) Add a State Change event to the Radio Button Group widget:
Input the following JavaScript codes:
var input = this.getValue(); // Get the current widget value
function test(){ // If other is picked, the test function will be executed
var num = arguments[0].toString(); // Get the value typed in the text field
contentPane.setCellValue("B2", null, num); // Display the value in B2
};
// Check if other is picked
if(input == "other"){
FR.Msg.prompt("Input", "Hobby", "",test); // An input box pops up and the test function is to be executed
}
else{
contentPane.setCellValue("B2", null, input); // Display the selected value in B2
}
2.2 Preview
Save the template and click [Data Entry Preview]. The preview effect on a PC is shown as below: