Visual Builder

Get Involved. Join the Conversation.

Topic

    Stephen Bryant
    Validator -- Convert Arrow Function to Normal Function
    Topic posted August 19, 2019 by Stephen BryantBronze Trophy: 5,000+ Points, tagged Action Flows, Custom Code, UI 
    16 Views, 1 Comment
    Title:
    Validator -- Convert Arrow Function to Normal Function
    Summary:
    Validator For Numbers or anything else
    Content:

    Hello,

    This question is based on Shay's original post at: https://cloudcustomerconnect.oracle.com/posts/3a15dbfbe8

    Does anyone know how to convert this arrow function to normal javascript?  I've tried but the way we need to call it in VBCS is confusing me.

    PageModule.prototype.numericValidator = function(newValue) {
        return [{
          validate: (newValue) => {
            if (isNaN(newValue)) {
                throw new Error('Must be a number');
              }
              return true;
            }
        }];
      };

     

    Thanks,

    Steve

     

     

    Version:
    19.1.3

    Comment

     

    • David Konecny
      PageModule.prototype.numericValidator = function(newValue) {
          return [{
            validate: function(newValue) {
              if (isNaN(newValue)) {
                  throw new Error('Must be a number');
                }
                return true;
              }
          }];
        };
      

       

      -David