|
Problem(Abstract) |
This document describes how to validate comma delimited
email addresses using JavaScriptâ„¢ |
|
|
|
Resolving the
problem |
In order to validate email address that are separated by
commas and be certain that only one @ symbol was used with each address.
This issue is solved by developing a JavaScript function, which takes the
following three parameters:
- form object
- field object
- field name.
The field object is then passed into an array. If it contains commas, it
is separated using the split() method.
The next test is to identify whether the email matches the pattern
/(\S+)(@)(\S+)/ where (/S+) represents non-whitespace characters. If the
address fails an alert is thrown.
The pattern described above will pass because the (/S+) matches all
non-whitespace characters. The next step is to test for an additional @
symbol. If one is found, an alert is thrown. |
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|