[erlang-questions] List comprehension puzzler
Richard A. O'Keefe
ok@REDACTED
Wed Sep 21 05:08:05 CEST 2016
On 21/09/16 10:43 AM, lloyd@REDACTED wrote:
> Thanks Joe and Jesper.
>
> In my case the ISBN numbers come as callback (if I'm using the right term)
>from an HTML form.
It's hard to believe I'm saying this, but if the HTML form is under
your control, why not validate the ISBNs with JavaScript code in the
form? You could use regular expressions like
/^[0-9]([- ]?[0-9]){8}[- ]?([0-9X]|[0-9]([- ]?[0-9]){3})$/
to check their format and there are quite a few ISBN checksum validators
for JavaScript out there on the web.
That way the user gets immediate feedback.
Let's face it, this is one of the jobs JavaScript-in-the-browser
was designed to do.
> I do understand that in the scheme of things ISBN validation will have little
to no influence on user experience or the performance the system as a
whole.
Doing it in the client will definitely have an influence on user
experience: a positive one. As for system performance, a failed check
in the browser saves a round trip to the server.
More information about the erlang-questions
mailing list