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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -