Index: lams_tool_forum/web/jsps/learning/mobile/message/bodyarea.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/mobile/message/bodyarea.jsp,v diff -u -r1.2.2.1 -r1.2.2.2 --- lams_tool_forum/web/jsps/learning/mobile/message/bodyarea.jsp 30 Dec 2014 09:44:06 -0000 1.2.2.1 +++ lams_tool_forum/web/jsps/learning/mobile/message/bodyarea.jsp 23 Aug 2015 04:15:34 -0000 1.2.2.2 @@ -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; } });