How to pass error message from backend (data.js) to frontend

I have developed a simple website to allow members of my golf group sign up to play each week.

I am not an experienced coder, so I copied code I found in a Velo example online ( . I modified this code for my site and it works fine. In the screen shot of the sign-up page above, you can see the error message “You are already signed up for this week”, which displays if a golfer tries to sign up a second time. My problem is that I need to make the First Name and Last Name fields required, which I know I can do using the settings for those fields in the page editor. But when I do that, of course, the default “You are already signed up” error message displays, which is not what I want. Is there a simple way I could send an error message from the backend code to the front end so I could conditionally display the “You are already signed up” message, perhaps using the $w function show() and hide() properties? If so, then I could make the name fields required in the editor and change the associated default error message accordingly. Any suggestions would be appreciated!

Here is a screen shot of my backend code: