Commit 05b60df9 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Simple validation that e-mail addresses are not longer than 255 characters

parent c4d1895f
......@@ -25,13 +25,18 @@
removeElement({{$name}}_newref);
var newEmail = {{$name}}_newrefinput.value;
if (typeof(newEmail) == 'string' && newEmail.length > 0) {
appendChildNodes('{{$name}}_list', DIV({'class': 'unvalidated'},
INPUT({'type': 'hidden', 'name': '{{$name}}_invalid[]' , 'value': {{$name}}_newrefinput.value}),
' ',
{{$name}}_newrefinput.value,
A({'href': '', 'onclick': '{{$name}}_remove(this); return false'}, '[x]'),
' a validation email will be sent when you save your profile'
));
if (newEmail.length > 255) {
alert('E-mail addresses cannot be longer that 255 characters');
}
else {
appendChildNodes('{{$name}}_list', DIV({'class': 'unvalidated'},
INPUT({'type': 'hidden', 'name': '{{$name}}_invalid[]' , 'value': {{$name}}_newrefinput.value}),
' ',
{{$name}}_newrefinput.value,
A({'href': '', 'onclick': '{{$name}}_remove(this); return false'}, '[x]'),
' a validation email will be sent when you save your profile'
));
}
}
{{$name}}_newrefinput = null;
{{$name}}_newref = null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment