In the current app I'm building I've got a textarea where a user will enter a comma-delimited list of email addresses.
I'm currently splitting the list into an array and then saving one by one. But if, say, I have this input...
[email protected], test@example, [email protected]
... then [email protected] will be saved, but saving test@example will fail. So I then need to remove [email protected] from the comma-delimited string of values that I pass back to the textarea when I show the error that test@example isn't a valid email address.
Is there a better way to validate these on the server side and handle errors without getting fancy / ugly in the controller?
Thanks in Advance!