Hello,
I have the AllowCustomEntry set to true and I have the following scenario:
If the new Entry is an Email (has an email format) then add it normally, if the new Entry is not an email then
Check if the New Entry Exists in the DataSource/ENtryCollection, if it Exists then Do Nothing, if it doesn't exist
then I need to set the Background Color of the new Entry to Red.
This is what I have so far:
I have the AllowCustomEntry set to true and I have the following scenario:
If the new Entry is an Email (has an email format) then add it normally, if the new Entry is not an email then
Check if the New Entry Exists in the DataSource/ENtryCollection, if it Exists then Do Nothing, if it doesn't exist
then I need to set the Background Color of the new Entry to Red.
This is what I have so far:
<
script
type
=
"text/javascript"
>
function OnClientEntryAdded(sender, eventArgs) {
var newEntry = eventArgs.get_entry().get_text();
if (validateEmail(newEntry)) {
// If New Custom Entry is an Emeail Do Nothing
}
else {
// ELSE
// If New Custom Entry is Not an Email and It Does Not Exist in the
// DataSource/Items then I want the New Added Entry to have a RED
// Background Color so that it indicates that the Entry is incorrect.
// IF newEntry does NOT exist in the EntryCollection THEN
// Change the Background COlor of the New ENtry to Red
}
}
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
</
script
>
I also need to know how to use the remove() entry function within that event.