You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Validator -- Convert Arrow Function to Normal Function

edited Aug 19, 2019 8:22PM in Visual Builder 1 comment

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

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!