Number Form Validation

First off, I am a complete noob. I have just recently started getting good with python and have close to zero knowledge regarding javascript. I am looking through documentation but I can’t figure out how to do the following: When a user fills out a field, let’s say a phone number field, how do you validate whether that field has any alphabetical characters or “+” or “-” etc or not?

I am trying to do something like this:
$w.onReady( function () {
$w( “#input1” ).onCustomValidation( (value, reject) => {
if ( input1 is anything but an integer ) {
reject( “Only Numbers. No ‘-’, ‘.’, ‘()’, ‘+’, or any alphabetical characters” );
}
} );
});

I feel like I am close but have no idea. Any help is appreciated

Hi,
You could use JavaScript’s “typeof” operator .
The code could look something like :

$w.onReady(function () {
  $w("#input1").onCustomValidation( (value, reject) => {
 if(typeof input1 != "number") {
      reject("Only Numbers. No '-', '.', '()', '+', or any alphabetical characters");
 }
  } );
});

Hope this helps.