diff --git a/Classes/Utility/ConfigurationUtility.php b/Classes/Utility/ConfigurationUtility.php index 5e79605..02d57fd 100644 --- a/Classes/Utility/ConfigurationUtility.php +++ b/Classes/Utility/ConfigurationUtility.php @@ -12,7 +12,6 @@ class ConfigurationUtility { - public static function getConditionLoopCount(): int { $extConfigTemplatesSettings = self::getExtConfTemplateSettings(); @@ -28,7 +27,7 @@ protected static function getExtConfTemplateSettings(): array { try { $configuration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('powermail_cond'); - return ($configuration ?? []); + return $configuration ?? []; } catch (ExtensionConfigurationExtensionNotConfiguredException | ExtensionConfigurationPathDoesNotExistException $e) { return []; } diff --git a/Resources/Private/Build/JavaScript/PowermailConditions.js b/Resources/Private/Build/JavaScript/PowermailConditions.js index 46168eb..5d289a0 100644 --- a/Resources/Private/Build/JavaScript/PowermailConditions.js +++ b/Resources/Private/Build/JavaScript/PowermailConditions.js @@ -80,6 +80,11 @@ class PowermailConditions { activeElement.blur(); setTimeout(() => { + // don't submit if HTML validations fail + if (!this.#form.reportValidity()) { + return; + } + this.#form.submit(); }, 50); return; diff --git a/Resources/Public/JavaScript/PowermailCondition.min.js b/Resources/Public/JavaScript/PowermailCondition.min.js index 8786fa3..93dd7a3 100644 --- a/Resources/Public/JavaScript/PowermailCondition.min.js +++ b/Resources/Public/JavaScript/PowermailCondition.min.js @@ -1 +1 @@ -!function(){"use strict";function t(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}function e(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(e,i){return e.get(t(e,i))}function o(t,i,n){e(t,i),i.set(t,n)}function r(e,i,n){return e.set(t(e,i),n),n}function a(t,e){for(var i=0;ii.loopLimit?console.log("Too much loops reached by parsing conditions and rules. Check for conflicting conditions."):t(m,e,y).call(e,i)}).catch(function(t){console.log(t)})}function y(e){if(void 0!==e.todo)for(var i in e.todo)for(var o in e.todo[i])for(var r in"hide"===e.todo[i][o]["#action"]&&(n(h,this)&&c.hideElement(t(m,this,N).call(this,o)),t(m,this,L).call(this,t(m,this,M).call(this,o))),"un_hide"===e.todo[i][o]["#action"]&&(n(h,this)&&c.showElement(t(m,this,N).call(this,o)),t(m,this,_).call(this,t(m,this,M).call(this,o))),e.todo[i][o])"hide"===e.todo[i][o][r]["#action"]&&t(m,this,S).call(this,r),"un_hide"===e.todo[i][o][r]["#action"]&&t(m,this,E).call(this,r);n(d,this).querySelectorAll(".powermail_fieldset").forEach(function(t){"hidden"===window.getComputedStyle(t).visibility&&(t.style.visibility="visible",t.style.opacity=1)})}function g(){n(d,this).querySelectorAll('[disabled="disabled"]').forEach(function(t){t.removeAttribute("disabled")})}function q(){return n(d,this).querySelectorAll('input:not([data-powermail-validation="disabled"]):not([type="hidden"]):not([type="submit"]), textarea:not([data-powermail-validation="disabled"]), select:not([data-powermail-validation="disabled"])')}function A(){var t=document.querySelector("[data-condition-uri]");return null===t&&console.log("Tag with data-condition-uri not found. Maybe TypoScript was not included."),t.getAttribute("data-condition-uri")}function E(e){var i=t(m,this,x).call(this,e);null!==i&&c.showElement(i);var n=t(m,this,P).call(this,e);null!==n&&(n.removeAttribute("disabled"),t(m,this,k).call(this,n))}function S(e){var i=t(m,this,x).call(this,e);null!==i&&c.hideElement(i);var n=t(m,this,P).call(this,e);null!==n&&(n.setAttribute("disabled","disabled"),t(m,this,j).call(this,n))}function _(t){t.classList.remove("powermail-cond-hidden"),n(h,this)||c.showElement(t)}function L(t){n(h,this)?t.classList.add("powermail-cond-hidden"):c.hideElement(t)}function j(t){(t.hasAttribute("required")||t.hasAttribute("data-powermail-required"))&&(t.removeAttribute("required"),t.removeAttribute("data-powermail-required"),t.setAttribute("data-powermailcond-required","required"))}function k(e){"required"===e.getAttribute("data-powermailcond-required")&&(t(m,this,T).call(this)||t(m,this,C).call(this))&&e.setAttribute("required","required"),e.removeAttribute("data-powermailcond-required")}function C(){return"data-powermail-validate"===n(d,this).getAttribute("data-powermail-validate")}function T(){return"html5"===n(d,this).getAttribute("data-validate")}function x(e){var i=t(m,this,O).call(this,e);if(null!==i)return i;var n=t(m,this,P).call(this,e);if(null!==n){var o=n.closest(".powermail_fieldwrap");if(null!==o)return o}return console.log('Error: Could not find field by fieldMarker "'+e+'"'),null}function P(t){var e="tx_powermail_pi1[field]["+t+"]";return n(d,this).querySelector('[name="'+e+'"]:not([type="hidden"])')||n(d,this).querySelector('[name="'+e+'[]"]')}function M(t){return n(d,this).querySelector(".powermail_fieldset_"+t)}function N(t){return n(d,this).querySelector('.btn[data-powermail-fieldset="'.concat(t,'"]'))}function O(t){return n(d,this).querySelector(".powermail_fieldwrap_"+t)}window.addEventListener("pageshow",function(){document.querySelectorAll(".powermail_form").forEach(function(t){new p(t).initialize()})})}(); +!function(){"use strict";function t(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}function e(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(e,i){return e.get(t(e,i))}function o(t,i,n){e(t,i),i.set(t,n)}function r(e,i,n){return e.set(t(e,i),n),n}function a(t,e){for(var i=0;ii.loopLimit?console.log("Too much loops reached by parsing conditions and rules. Check for conflicting conditions."):t(m,e,y).call(e,i)}).catch(function(t){console.log(t)})}function y(e){if(void 0!==e.todo)for(var i in e.todo)for(var o in e.todo[i])for(var r in"hide"===e.todo[i][o]["#action"]&&(n(h,this)&&c.hideElement(t(m,this,N).call(this,o)),t(m,this,L).call(this,t(m,this,M).call(this,o))),"un_hide"===e.todo[i][o]["#action"]&&(n(h,this)&&c.showElement(t(m,this,N).call(this,o)),t(m,this,_).call(this,t(m,this,M).call(this,o))),e.todo[i][o])"hide"===e.todo[i][o][r]["#action"]&&t(m,this,S).call(this,r),"un_hide"===e.todo[i][o][r]["#action"]&&t(m,this,E).call(this,r);n(d,this).querySelectorAll(".powermail_fieldset").forEach(function(t){"hidden"===window.getComputedStyle(t).visibility&&(t.style.visibility="visible",t.style.opacity=1)})}function g(){n(d,this).querySelectorAll('[disabled="disabled"]').forEach(function(t){t.removeAttribute("disabled")})}function q(){return n(d,this).querySelectorAll('input:not([data-powermail-validation="disabled"]):not([type="hidden"]):not([type="submit"]), textarea:not([data-powermail-validation="disabled"]), select:not([data-powermail-validation="disabled"])')}function A(){var t=document.querySelector("[data-condition-uri]");return null===t&&console.log("Tag with data-condition-uri not found. Maybe TypoScript was not included."),t.getAttribute("data-condition-uri")}function E(e){var i=t(m,this,x).call(this,e);null!==i&&c.showElement(i);var n=t(m,this,P).call(this,e);null!==n&&(n.removeAttribute("disabled"),t(m,this,k).call(this,n))}function S(e){var i=t(m,this,x).call(this,e);null!==i&&c.hideElement(i);var n=t(m,this,P).call(this,e);null!==n&&(n.setAttribute("disabled","disabled"),t(m,this,j).call(this,n))}function _(t){t.classList.remove("powermail-cond-hidden"),n(h,this)||c.showElement(t)}function L(t){n(h,this)?t.classList.add("powermail-cond-hidden"):c.hideElement(t)}function j(t){(t.hasAttribute("required")||t.hasAttribute("data-powermail-required"))&&(t.removeAttribute("required"),t.removeAttribute("data-powermail-required"),t.setAttribute("data-powermailcond-required","required"))}function k(e){"required"===e.getAttribute("data-powermailcond-required")&&(t(m,this,T).call(this)||t(m,this,C).call(this))&&e.setAttribute("required","required"),e.removeAttribute("data-powermailcond-required")}function C(){return"data-powermail-validate"===n(d,this).getAttribute("data-powermail-validate")}function T(){return"html5"===n(d,this).getAttribute("data-validate")}function x(e){var i=t(m,this,O).call(this,e);if(null!==i)return i;var n=t(m,this,P).call(this,e);if(null!==n){var o=n.closest(".powermail_fieldwrap");if(null!==o)return o}return console.log('Error: Could not find field by fieldMarker "'+e+'"'),null}function P(t){var e="tx_powermail_pi1[field]["+t+"]";return n(d,this).querySelector('[name="'+e+'"]:not([type="hidden"])')||n(d,this).querySelector('[name="'+e+'[]"]')}function M(t){return n(d,this).querySelector(".powermail_fieldset_"+t)}function N(t){return n(d,this).querySelector('.btn[data-powermail-fieldset="'.concat(t,'"]'))}function O(t){return n(d,this).querySelector(".powermail_fieldwrap_"+t)}window.addEventListener("pageshow",function(){document.querySelectorAll(".powermail_form").forEach(function(t){new p(t).initialize()})})}();