javascript - How to Implement Required Validation on Text Boxes in JQuery Popup -


i have jquery popup includes text boxes. have applied required validation on text boxes model doesn't work in popup. without popup, validation works accurately. please in regard there special syntax in jquery popup controls validations.here popup code..

var dialogbox = $("#mc-dialog");         $('#dvmcodes').on('click', '#tblmc .modaledit', function (event) {              event.preventdefault();             var actionurl = $(this).attr('href');              //alert(actionurl);              $(dialogbox).dialog({                 autoopen: false,                 resizable: false,                 title: 'edit',                 modal: true,                 show: "blind",                 width: 'auto',                 hide: "blind",                 open: function (event, ui) {                     $(this).load(actionurl, function (html) {                         $('form', html).submit(function () {                             $.ajax({                                 url: this.action,                                 type: this.method,                                 data: $(this).serialize(),                                 success: function (res) {                                     if (res.success) {                                         $(dialogbox).dialog('close');                                     }                                 }                             });                             return false;                         });                     });                 }             });              $(dialogbox).dialog('open');         }); 

and here model's code

        [required(errormessage = "*")]         public string code { get; set; }         public string description { get; set; } 

and here html code

@if (iseditmode)                 {                     @html.labelfor(m => m.code)                     @html.textboxfor(m => m.code, new { @readonly = "readonly" })                 }                 else                    {                     @html.labelfor(m => m.code)                     @html.textboxfor(m => m.code)                     @html.validationmessagefor(m => m.code)                 }              </li>              <li>                 @html.labelfor(x => x.description)                 @html.textareafor(x => x.description)             </li> 

$(this).submit(function (event) {          if ($.trim($('#code').val()).length == 0) {             alert('please enter value code');             event.preventdefault();         }     }); 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -