I have a scenario in my application where end users can send mail to multiple users with seperator ' ; ', they can select from combo items(contact name) or they can enter a new contact's email id. when they enter mail id which is not in the combo list item, i shoud popup the add contact modal popup and once they add it, i will bind the added user and they can select it from combo. so when user sends the mail, i need to get selected contact's contact id and send the mail to those id's
I was able to achieve the above functionality with few issues,
they are
1. when user type a text 'Ra' and combo lists the 'Raja', if user uses keyboard and presses END button and ' ; ', my code assumes it as some text entered other than item frm combo, if user presses 'Ra' and user selects the Raja using mouse and presses ';' means my code works fine.
2. when users enters mail id alone and not entering ';' means, i cant prompt user to add contact.
3. Im storing the contact id in hidden field and when i click send button I'm retrieving it.
I used radcombo, binding its data from web method as follows
<telerik:RadComboBox ID="rdCombotxtToUser" runat="server" Width="397px" Height="140px" Enabled="false"
EmptyMessage="Please enter your contacts (e.g John Doe;Jane Doe)" AllowCustomText="true" AutoCompleteSeparator=";" EnableAutomaticLoadOnDemand="true" EnableItemCaching="true" MarkFirstMatch="true" OnClientKeyPressing="OnClientKeyPressing">
<WebServiceSettings Method="GetContactName" Path="~/WebServices.asmx" />
</telerik:RadComboBox>
When users enters ; im firing following below javascript
function OnClientKeyPressing(sender, e)
{
var strSelecteditem
if (e._domEvent.keyCode == "186")
{
var combo = $find("<%= rdCombotxtToUser.ClientID %>");
strSelecteditem = combo._selectedItem;
if (strSelecteditem == null) {
var mdlPopup = $find("mdladdContactPopupBId");
document.getElementById(
"<%=txtName.ClientID %>").value = combo._filterText;
mdlPopup.show();
}
}
Can anyone suggest me any other method or solution to prompt user only when mail id or items not in combo is entered.