JS Click Radio Button Pop Up a Dialog Box to Enter Value

  • Last update:  2020-12-16
  • 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.gif 


    1.2 Solution

    Add a State Change event to the Radio Button Group widget.

    You will learn
    • Sample

      • Steps

      • Preview

    • Download the template

    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:

     

    III. Download the template

    Attachment List


    Theme: Data Entry
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy