Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One solution you can do is check as the autocomplete fills out. This is some sample code for filling out my text field.</p> <pre><code>$("#search").autocomplete({ source: function (request, response) { $.ajax({ url: "MyWebService.asmx/FetchUsers", data: "{ 'search': '" + request.term + "' }", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (data) { response($.map(data.d, function (item) { return { value: item } })) }, error: AjaxFailed }); }, minLength: 3 }); </code></pre> <p>So you can change the success to look like</p> <pre><code>success: function (data) { if (data.d.length == 0) alert('Does Not Exist'); else { response($.map(data.d, function (item) { return { value: item } })) } } </code></pre> <p>If you want to do it as they hit the click button, you can create a button and tie a javascript function to the onClick event to do a post to a webservice and check if the value exists so it'd be something along the lines of this:</p> <pre><code>&lt;asp:Button ID="Button1" runat="server" onclick="verifyFriendExists()"&gt;&lt;/asp:Button&gt; &lt;script type="text/javascript"&gt; function verifyFriendExists() { var user = $('#userbox').value; $.ajax({ type: "POST", url: "MyWebService.asmx/VerifyParticipant", data: "{'user': '" + user + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { if (msg.d != "Success") alert('Does Not Exist'); }, error: AjaxFailed }); } &lt;/script&gt; </code></pre> <p>And create a WebService with a method that's something like</p> <pre><code>[WebMethod] public String VerifyParticipant(string user) { bool userExists = CheckParticipant(user); if (userExists) return "Success"; else return "Does Not Exist"; } </code></pre> <p>I know that's a lot to look over. Let me know if I wasn't clear on something. Good luck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload