asp.net mvc - Summernote and form submission in MVC c# -



asp.net mvc - Summernote and form submission in MVC c# -

i using summernote plugin text box: http://summernote.org/#/getting-started#basic-api

this form have using summmernote:

<div class="modal-body" style="max-height: 600px"> @using (html.beginform()) { @html.validationsummary(true) <fieldset class="form-horizontal"> <div id="textforlabellanguage"></div> <button type="submit" class="btn btn-primary">save changes</button> @html.actionlink("cancel", "index", null, new { @class = "btn " }) </fieldset> } </div> <script type="text/javascript"> $(document).ready(function () { $('#textforlabellanguage').summernote(); }); </script>

now, in controller, code have:

public actionresult create(userinfo newinfo , [bind(prefix = "textforlabellanguage")] string textforlabellanguage) { //logic here }

now problem textforlabellanguage param null.

this happens because have pass $('#textforlabellanguage').code(); mvc when submiting form have no thought how that!

how solve problem?

i found solution problem. how making controller right information:

<div class="modal-body" style="max-height: 600px"> @using (html.beginform()) { @html.validationsummary(true) <fieldset class="form-horizontal"> <textarea name="textforlabellanguage" id="textforlabellanguage" /> <button type="submit" class="btn btn-primary">save changes</button> @html.actionlink("cancel", "index", null, new { @class = "btn " }) </fieldset> } </div> <script type="text/javascript"> $(document).ready(function () { $('#textforlabellanguage').summernote(); }); </script>

basically, if utilize textarea name instead of input or else, works!

however, , warned, though solution works, error in controller saying:

a potentially unsafe request.form value detected client

this happens because allowing html. problem question!

c# asp.net-mvc forms summernote

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -