2 Replies Latest reply on Nov 8, 2018 7:41 PM by Derek Solis

    Check if value entered in page item or IG-column is a number with a Client-Side Javascript Expression

    Derek Solis

      The idea is to be able to check to see if the value entered into a field is a number or not. It's a javascript function that can be used inside a client-side javascript expression for a dynamic action for a page item or IG column.

       

      In this example I will use the javascript function to check to see if the value keyed down inside an interactive grid cell is a number.

       

      Place this in the Page => Function and Global Variable Declaration =>

       

      function isNumber(n) {

        return !isNaN(parseFloat(n)) && isFinite(n);

      }

       

       

       

       

      Then create a dynamic action on the IG column (in my case a 'Number Field' IG column type):

       

      When => Event = Key Down/Release/Press (depending on use)

       

      Client-side Condition => Type = Javascript expression

                                        => Javascript Expression =                  isNumber($v(this.triggeringElement))

       

       

       

       

      If the value entered in the IG cell is a number then the True Action will execute. This function could really be placed in any page item or IG column to be used to evaluate the value in the item/column. The function itself could be easily modified to evaluate the value in all kinds of ways.

        • 1. Re: Check if value entered in page item or IG-column is a number with a Client-Side Javascript Expression
          Alli Pierre Yotti

          Derek Solis wrote:

           

          The idea is to be able to check to see

          if the value entered into a field is a number or not.It 's a javascript function that can be used inside a client-side javascript expression for a dynamic action for a page item or IG column.

           

          In this example I will use the javascript

          function to check to see

          if the value keyed down inside an interactive grid cell is a number.

           

          Place this in the Page => Function and Global Variable Declaration =>

              function isNumber(n) {

                  return !isNaN(parseFloat(n)) && isFinite(n);

              }

           

          Then create a dynamic action on the IG column( in my

                  case a 'Number Field'

                  IG column type):

           

              When => Event = Key Down / Release / Press(depending on use)

           

          Client - side Condition => Type = Javascript expression

           

              => Javascript Expression = isNumber($v(this.triggeringElement))

           

           

          If the value entered in the IG cell is a number then the True Action will execute.This

          function could really be placed in any page item or IG column to be used to evaluate the value in the item / column.The

          function itself could be easily modified to evaluate the value in all kinds of ways.

           

          We don't see any issues here. Is it? If so check that blog for john

          APEX Client-Side Validation – HardLikeSoftware

           

          or take a look at the Page 51 for the sample interactive Grids

          • 2. Re: Check if value entered in page item or IG-column is a number with a Client-Side Javascript Expression
            Derek Solis

            No there are no issues here. I was just posting this as a simple way for people to do client-side validation using javascript against a value in a page item/ IG column.