Index: lams_tool_forum/web/jsps/learning/mobile/message/bodyarea.jsp =================================================================== diff -u -rac12c171d18673d283c3304f1333ebb00e3819d0 -r327fa6b80aab6d922ff1f105e8a9926449190013 --- lams_tool_forum/web/jsps/learning/mobile/message/bodyarea.jsp (.../bodyarea.jsp) (revision ac12c171d18673d283c3304f1333ebb00e3819d0) +++ lams_tool_forum/web/jsps/learning/mobile/message/bodyarea.jsp (.../bodyarea.jsp) (revision 327fa6b80aab6d922ff1f105e8a9926449190013) @@ -27,21 +27,20 @@ return wordCount; } - //bind to pagebeforechange in order to prevent form submition (as per https://github.com/jquery/jquery-mobile/issues/729) + //bind to pagebeforechange in order to prevent form submission (as per https://github.com/jquery/jquery-mobile/issues/729) $(document).bind('pageinit', function(){ $('#topic-form').submit(function (e) { //cache the form element for use in this function var $this = $(this); - //prevent the default submission of the form + //prevent the default submission of the form when false is returned + // jquery mobile automatically triggers the submit. e.preventDefault(); - if (validateForm()) { - //run an AJAX post request - $.post($this.attr('action'), $this.serialize()); - } else { + if (! validateForm()) { + e.stopImmediatePropagation(); return false; } });