javascript - Display unobtrusive message for jquery autocomplete field -


i can't seem find answer problem. have simple jquery autocomplete field , entry required model. when check validation method not highlighted.

 <tr>             <td>                 <b style="color:red">*</b>find user id or enter new:<br />                 @html.validationmessagefor(x=>x.userid)             </td>             <td>                 <input id="users" class="usermodel" style="text-transform:uppercase" />                 @html.hiddenfor(x=>x.userid, new { @id = "txtuserid" })             </td>         </tr>   $("#users").autocomplete({         delay: 0,         minlength: 0,         autofocus: true,         source: function (request, response) {             $.ajax({                 type: 'post',                 data: { 'data': request.term },                 datatype: 'json',                 url: '@url.action("getallusers")',                 success: function (data) {                     response($.map(data, function (obj) {                         return {                             value: obj                         }                     }));                 }             });         },         select: function (event, ui) {             neworold = "old";             $.ajax({                 type: 'get',                 datatype: 'json',                 url: '@url.action("getuser")',                 data: { userid: ui.item.label },                 success: function (data) {                     $("#txtusername").val(data.username);                     $("#ddluserrole").val(data.userrole);                     $("#chkuseradmin").prop("checked", data.admin);                     $("#chkusertrans").prop("checked", data.trans);                     $("#chkuserreports").prop("checked", data.reports);                     $("#txtuserid").val(data.userid);                 },                 error: function (xhr) {                     var err = xhr.responsetext;                     alert('error');                 }             });         }     }).focus(function () {         $("#users").autocomplete('search', $("#users").val());     }).blur(function () {         var keyevent = $.event("keydown");         keyevent.keycode = $.ui.keycode.enter;         $(this).trigger(keyevent);         if (neworold != "old") {             $("#txtuserid").val($("#users").val());         }     });      if (!$("#userform").valid()) {         return false;     } 


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -