jquery - ASP.NET MVC4 Text Input Modal Dialog -
i building extensive web application has dozens of places requires end user add comment , looking best way abstract partial view renders modal dialog comment , re-binds model.
for instance, user adds allergy patient profile, removes it. comment required when removed, , store comment in removalreason property on allergy model.
has ever coded in bulk? modal code looks similar this
@model string <div id="text-input-modal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="modallabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button> <h3 id="modallabel"> text input </h3> </div> <div class="modal-body"> @html.textboxfor(x => x) </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">close</button> <button class="btn btn-primary btn-text-input-submit">save</button> </div>
<script type="text/javascript"> $(function () { $('.btn-text-input-submit').click(function () { $('#text-input-modal form').submit(); }); }); </script>
missing form tag,
<form id="text-input-modal"> <div class="modal hide" tabindex="-1" role="dialog" aria-labelledby="modallabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button> <h3 id="modallabel"> text input </h3> </div> <div class="modal-body"> @html.textboxfor(x => x) </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">close</button> <button class="btn btn-primary btn-text-input-submit">save</button> </div> </form>
good luck!
Comments
Post a Comment