Automatic Alert Sound by JS

  • Last update:July 10, 2025
  • Overview

    Problem

    When the data entered does not match the actual situation, an alert is triggered for the entered data. For data entry templates, simple information prompts may be overlooked. This document provides a method of using an alert sound as a prompt.

    For example, if you modify the reorder quantity to be more than 100, you can hear an alert sound after refreshing the page, as shown in the following figure.

    Implementation Method

    You can add a condition attribute to limit the entered value and set a Loading End event to trigger an alert sound.

    iconNote:

    1. For scenarios other than data entry, you can refer to the condition attribute in this example. Setting a proper condition attribute can also achieve the same effect of an automatic alert in these scenarios.

    2. Multiple preview methods are supported in this solution.

    Example

    Template Preparation

    Open the template LineForm1 in FineReport installation directory\webapps\webroot\WEB-INF\reportlets\doc-EN\Form\LineForm.

    Condition Attribute

    1. Add a condition attribute whose Attribute is set to New Value for cell L3, as shown in the following figure.

    New Value is set to the string <embed width="0" height="0" src="/webroot/help/5196.mp3" autostart="true" loop="true" hidden="true"></embed>.

    The formula condition is J3 > 100.

    iconNote:
    src in the condition attribute is the address for the music file. You need to save the alert sound file to the help folder in FineReport Installation directory/webroot. Network addresses are not supported currently.

    You can download the alert sound file 5196.zip.

    2. Set Display Content to Display by HTML for cell L3 under Cell Attribute > Others.

    iconNote:
    Display Content must be set to Display by HTML. Otherwise, the sound cannot be played.

    Template Web Attribute

    Choose Template > Web Attribute > Data Entry Setting, and add a Loading End event to refresh the data entry page automatically, as shown in the following figure.

    The JavaScript code is as follows.

    setInterval("self.location.reload();",36000);

    iconNote:
    You need to enter the code in the Loading End event on the corresponding setting page according to the preview method.

    Preview Effect

    Save the template and click Data Entry Preview. The effect is the same as that shown in section "Problem."

    iconNote:
    The effect cannot be previewed on mobile terminals.

    If the alert sound cannot be played normally in the Chrome browser, enter chrome://settings/content/sound in the address bar of the browser to open the sound setting.

    To play the alert automatically, add http://IP Address:Port Number/webroot/decision in Allowed to play sound, as shown in the following figure.

    Template Download

    For details, you can download the template Automatic Alert Sound by JS.cpt.

    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • 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