Dynamic Action - On KEY Press vs. UDF javascript Function

Tom LieberTom Lieber
1 min read

What is easier to configure? on ITEM Numeric Input Check:

We use this approach on Item level.


function isInputNumberNoComma(event) {
    var ch = String.fromCharCode(event.which);
    // Erlaubt Ziffern, Komma und Enter-Taste
    if (!(/[0-9]/.test(ch)) && event.which !== 13) {
        event.preventDefault();
    }
}

The isInputNumberNoComma function is a JavaScript event handler designed to restrict input to numeric digits only. Here’s a breakdown of its functionality:

  1. Retrieve Character: It uses String.fromCharCode(event.which) to get the character associated with the key that was pressed.

  2. Allow Digits and Enter Key Only: It checks if the character is a numeric digit (0-9) or if the Enter key (key code 13) is pressed.

  3. Prevent Non-Numeric Input: If the character is not a digit and isn't the Enter key, event.preventDefault() is called to prevent the input.

Oracle Apex Solution (low code?)

You need this add Dynamic Action to a TextField or Numeric Field

Choose Event on - key press

with this action

call a javascript code..

Both works - which is more work? What do you think?

best wishes tom

0
Subscribe to my newsletter

Read articles from Tom Lieber directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tom Lieber
Tom Lieber

Databaseguy, Oracle Apex Lover