{"id":994379,"date":"2015-08-07T14:18:55","date_gmt":"2015-08-07T21:18:55","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/"},"modified":"2015-09-04T15:31:18","modified_gmt":"2015-09-04T22:31:18","slug":"js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/","title":{"rendered":"JS bug with recurring event end date for Events Calendar Pro 3.11.1"},"content":{"rendered":"<p>Our QA engineer filed a bug report (pasted below), where trying to save a recurring event without a recurrence end date renders the publish button unusable. I believe I&#8217;ve tracked down the issue to a JS conflict between your plugin (Events Calendar Pro 3.11.1) and Advanced Custom Fields Pro (version 5.2.8).<\/p>\n<p>The reason I&#8217;m posting here is because I think the fix that makes the most sense would affect your plugin. I believe the issue lies with the submit event handler defined in \/events-calendar-pro\/src\/resources\/js\/events-admin.js on lines 67 and 89 (not sure why it&#8217;s in there twice). If there isn&#8217;t a valid recurrence end date, this handler alerts the user of the error and calls e.preventDefault() to prevent the submission. However, preventDefault doesn&#8217;t stop the propagation of this event (<a href=\"http:\/\/stackoverflow.com\/a\/1357151\">see this StackOverflow article for more details<\/a>). I&#8217;d propose adding in a call to e.stopPropagation() or a return false at the end of the conditional in this event handler. This should prevent additional submit event handlers (like the one from the ACF plugin) from running as well.<\/p>\n<p>TL;DR:<\/p>\n<p>Change this:<\/p>\n<pre><code>$( &#039;.wp-admin.events-cal #post&#039; ).submit( function( e ) {\n\tif ( !validRecEnd() ) {\n\t\te.preventDefault();\n\t\talert( $( &#039;#rec-end-error&#039; ).text() );\n\t\t$( &#039;#rec-end-error&#039; ).show();\n\t\tresetSubmitButton();\n\t}\n} );<\/code><\/pre>\n<p>to this:<\/p>\n<pre><code>$( &#039;.wp-admin.events-cal #post&#039; ).submit( function( e ) {\n\tif ( !validRecEnd() ) {\n\t\talert( $( &#039;#rec-end-error&#039; ).text() );\n\t\t$( &#039;#rec-end-error&#039; ).show();\n\t\tresetSubmitButton();\n\t\treturn false;\n\t}\n} );<\/code><\/pre>\n<p>Thoughts?<\/p>\n<p>______________________________________________________<\/p>\n<p><strong>Bug Report Summary:<\/strong><br \/>\nIf I am creating or editing an event, one that is reoccurring in particular, it is possible to have the Publish\/Update and Save Draft buttons become unusable.<br \/>\nTo do this, when you are creating a new event (or editing an existing one although this would take some extra steps to accomplish) if you forget to set the \u201cend date\u201d for the reoccurring nature of the event, and you click the Publish button you will get a message that you first need to set the end date.<br \/>\nAfter setting the end date though, all of the buttons related to saving a draft or publishing the event become unusable. There is no way that I can see to get these buttons to work again, aside from leaving the edit event screen, finding it in the drafts section, and fixing the end date there before clicking publish.<\/p>\n<p><strong>Steps To Reproduce:<\/strong><\/p>\n<ul>\n<li>Setup a fake test event, and make the event reoccurring in the Time &amp; Date portion, but DO NOT assign an end date for the reoccurring events yet.<\/li>\n<li>Once everything except the end date is in place, click Publish<\/li>\n<li>Error will come up telling you to set the end date, so do that now<\/li>\n<li>Now try to click Publish (or Save Draft)<\/li>\n<li>Unable to click either of these buttons (as well as the Preview button)<\/li>\n<\/ul>\n","protected":false},"template":"","class_list":["post-994379","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JS bug with recurring event end date for Events Calendar Pro 3.11.1 -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JS bug with recurring event end date for Events Calendar Pro 3.11.1 -\" \/>\n<meta property=\"og:description\" content=\"Our QA engineer filed a bug report (pasted below), where trying to save a recurring event without a recurrence end date renders the publish button unusable. I believe I&#8217;ve tracked down the issue to a JS conflict between your plugin (Events Calendar Pro 3.11.1) and Advanced Custom Fields Pro (version 5.2.8). The reason I&#8217;m posting [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-09-04T22:31:18+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/\",\"name\":\"JS bug with recurring event end date for Events Calendar Pro 3.11.1 -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-08-07T21:18:55+00:00\",\"dateModified\":\"2015-09-04T22:31:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JS bug with recurring event end date for Events Calendar Pro 3.11.1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JS bug with recurring event end date for Events Calendar Pro 3.11.1 -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/","og_locale":"en_US","og_type":"article","og_title":"JS bug with recurring event end date for Events Calendar Pro 3.11.1 -","og_description":"Our QA engineer filed a bug report (pasted below), where trying to save a recurring event without a recurrence end date renders the publish button unusable. I believe I&#8217;ve tracked down the issue to a JS conflict between your plugin (Events Calendar Pro 3.11.1) and Advanced Custom Fields Pro (version 5.2.8). The reason I&#8217;m posting [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/","article_modified_time":"2015-09-04T22:31:18+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/","name":"JS bug with recurring event end date for Events Calendar Pro 3.11.1 -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-08-07T21:18:55+00:00","dateModified":"2015-09-04T22:31:18+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/js-bug-with-recurring-event-end-date-for-events-calendar-pro-3-11-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"JS bug with recurring event end date for Events Calendar Pro 3.11.1"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/994379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/994379\/revisions"}],"predecessor-version":[{"id":994381,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/994379\/revisions\/994381"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=994379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}