Custom Validation help

Hi
I have the code below and i’m using a regex pattern to allow for text only but when I enter text or numeric response in my user input field, the validation message displays. I have very limited experience with coding, any help would be appreciated.

export function firstName_change(event) {
let validationMessage = ‘’;

if (!$w(‘#firstName’).valid) {
validationMessage += ‘This field allows text only’;

       $w('#validationMessages').text = validationMessage; 
        $w('#validationMessages').expand(); 

    } 

else
$w(‘#validationMessages’).collapse();

} 

Regex pattern : [1]+$


  1. a-z A-Z ↩︎