jquery-dirtyforms not working with ajax actionlink - UpdateTargetID -
i have jquery.dirtyforms configured on forms in site. works fine when form dirty , try example close page. doesn't work @ unobtrusive ajax call. (ajax.actionlink), call proceeds normal.
any ideas?
code:
<html> <head> <meta name="viewport" content="width=device-width" /> <title>create</title> <script src="~/scripts/jquery-2.2.1.js"></script> <script src="~/scripts/jquery.unobtrusive-ajax.js"></script> <script src="~/scripts/jquery.dirtyforms.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('form').dirtyforms(); }) </script> </head> <body> @using (html.beginform()) { @html.antiforgerytoken() <div id="update"> <div class="form-horizontal"> @html.validationsummary(true, "", new { @class = "text-danger" }) <div class="form-group"> @html.labelfor(model => model.title, htmlattributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.title, new { htmlattributes = new { @class = "form-control" } }) @html.validationmessagefor(model => model.title, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="create" class="btn btn-default" /> </div> </div> </div> </div> } <div> @html.actionlink("back list", "index") @ajax.actionlink("back list", "index", new ajaxoptions {updatetargetid = "update"}) </div> </body> </html>
when form dirty, html.actionlink triggers stay/leave pop-up, ajax.actionlink proceeds , loads index view in desired div. trying achieve trigger dirtyforms pop-up when clicking ajax.actionlink.
Comments
Post a Comment