Hello Wix experts !
yesterday I spent a couple hours trying to debug this endsWith error I got from a sample code from this tutorial : https://support.wix.com/en/article/velo-about-validating-user-input-with-code
I don’t understand why I can’t check the end of the string “#input2” which is my email field (to register to the website).
Is there a problem with the fiels type (Maybe it’s not a string?) And if yes, how to convert it?
Thanks for your unestimable help !
A Velo noobie
Note : When I preview the website, it seems to work but not when I publish the site.
This is the error message I get, while I mouseover the error.
It’s not a real error, just wrong IDE indication.
You can leave it as is (or define the @type of the value parameter in case you want to stop seeing it).
OK JD ! Thank you for your quick reply!
But it doen’t seems to work in the end.
Because I want to avoid students with the wrong email to register to my website.
And I can actually register with another of my gmail address.
Do you have an idea what I should do to have this behavior?
Maybe a regex filter?
Thanks again for your help !
Nico
I don’t see any reason why it shouldn’t work, unless you accidentally removed the “required” check.
(Your code make it accept only email addresses of the specified domain name).
@jonatandor35 No, the “required” check is still on (you can see the star after the label on top of the field). I really don’t get it, it behave like there is no custom code behind.
Maybe because this is the “custom register form” and that there are specific rules, so we can simply not do it?
I don’t get it…