javascript - TinyMCE, 2 times to Validate Even When Textbox Not Empty -
using tinymce , validation, takes 2 times post , doesn't matter whether textarea empty or not. research wasn't able find worked. below code snippets.
model
[required(errormessage = "*response required")] [uihint("tinymce_jquery_full"), allowhtml] public string librarianresponse { get; set; }
view
<span style="color: red;font-weight: 700;">@html.validationmessagefor(m => m.librarianresponse)</span> <div class="editor-field"> @html.editorfor(model => model.librarianresponse) </div> <script type="text/javascript"> jquery(function ($) { $('#submit').click(function () { tinymce.triggersave();}); }); </script> <input type="submit" value="submit" />
thank in advance.
okay resolved issue. original code correct.
you'll notice in original question have following code:
<script type="text/javascript"> jquery(function ($) { $('#submit').click(function () { tinymce.triggersave();}); }); </script>
also, have below textarea
:
<span style="color: red;font-weight: 700;"> @html.validationmessagefor(m => m.librarianresponse) </span> <div class="editor-field"> @html.editorfor(model => model.librarianresponse) </div>
all had put librarianresponse
(which id
of textarea
in google chrome - spotted using dev tools) .triggersave
function.
so worked. see below:
jquery(document).ready(function ($) { $('#submit').click(function () { tinymce.triggersave('#librarianresponse'); }); });
thanks responded question. appreciate it.
Comments
Post a Comment