From 58142a8a576bdc94c6982b00ca1635050b4f13b0 Mon Sep 17 00:00:00 2001 From: Akash Date: Thu, 28 May 2020 11:32:54 +0530 Subject: [PATCH 1/7] Added Email Validation String --- language/en-GB/en-GB.mod_jdsimplecontactform.ini | 1 + tmpl/default.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/language/en-GB/en-GB.mod_jdsimplecontactform.ini b/language/en-GB/en-GB.mod_jdsimplecontactform.ini index 6f4f9dd..e2d2800 100644 --- a/language/en-GB/en-GB.mod_jdsimplecontactform.ini +++ b/language/en-GB/en-GB.mod_jdsimplecontactform.ini @@ -94,6 +94,7 @@ MOD_JDSCF_CSS_DESC="" MOD_JDSCF_IPADDR_LBL="Include IP Address" MOD_JDSCF_IPADDR_DESC="Collects IP address of the user and include it in the email received by the admin." +MOD_JDSCF_EMAIL_REQUIRED_ERROR="This value should be a valid email." MOD_JDSCF_REQUIRED_ERROR="%s is required." MOD_JDSCF_NUMBER_MIN_LENGTH_ERROR="%s should have %s characters or more." MOD_JDSCF_NUMBER_MAX_LENGTH_ERROR="%s should have %s characters or fewer." diff --git a/tmpl/default.php b/tmpl/default.php index 36b13c4..51903bf 100644 --- a/tmpl/default.php +++ b/tmpl/default.php @@ -37,7 +37,7 @@

-
+ " data-parsley-validate data-parsley-errors-wrapper="" data-parsley-error-class="border-danger" data-parsley-success-class="border-success" id="simple-contact-form-id; ?>" enctype="multipart/form-data">
Date: Thu, 28 May 2020 18:42:39 +0530 Subject: [PATCH 2/7] =?UTF-8?q?Added=20Scroll=20Up=20for=20header=20errors?= =?UTF-8?q?=20=F0=9F=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tmpl/default.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmpl/default.php b/tmpl/default.php index 51903bf..62ee2df 100644 --- a/tmpl/default.php +++ b/tmpl/default.php @@ -142,6 +142,10 @@ setTimeout(function () { $('#jdscf-message-id; ?>').html(''); }, 3000); + + $('html, body').animate({ + scrollTop: $('#simple-contact-form-id; ?>').offset().top - 150 + }, 300); } $('#simple-contact-form-id; ?>').on('submit', function (e) { e.preventDefault(); From 556efcd364a8790f216f05ad914518064a2bba7e Mon Sep 17 00:00:00 2001 From: Akash Date: Thu, 28 May 2020 18:49:02 +0530 Subject: [PATCH 3/7] =?UTF-8?q?Fixed=20email=20error=20location=20?= =?UTF-8?q?=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/fields/text.php | 1 + tmpl/default.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/fields/text.php b/layouts/fields/text.php index f2b526e..0a99374 100644 --- a/layouts/fields/text.php +++ b/layouts/fields/text.php @@ -12,6 +12,7 @@ switch ($field->type) { case 'email': $attrs[] = 'data-parsley-type="email"'; + $attrs[] = 'data-parsley-type-message="' . JText::_("MOD_JDSCF_EMAIL_REQUIRED_ERROR") . '"'; break; case 'number': $attrs[] = 'data-parsley-type="number"'; diff --git a/tmpl/default.php b/tmpl/default.php index 62ee2df..2f21b7d 100644 --- a/tmpl/default.php +++ b/tmpl/default.php @@ -37,7 +37,7 @@

- " data-parsley-validate data-parsley-errors-wrapper="" data-parsley-error-class="border-danger" data-parsley-success-class="border-success" id="simple-contact-form-id; ?>" enctype="multipart/form-data"> +
Date: Fri, 29 May 2020 11:35:39 +0530 Subject: [PATCH 4/7] =?UTF-8?q?Added=20Smooth=20scroll=20for=20Parsley=20e?= =?UTF-8?q?rrors=20=F0=9F=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tmpl/default.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tmpl/default.php b/tmpl/default.php index 2f21b7d..70ea952 100644 --- a/tmpl/default.php +++ b/tmpl/default.php @@ -147,6 +147,17 @@ scrollTop: $('#simple-contact-form-id; ?>').offset().top - 150 }, 300); } + + // Smooth Scroll to parsley errors + $('#simple-contact-form-id; ?>').parsley().on('field:validated', function() { + var errorNotice = $('ul.text-danger li'); + if ( errorNotice.length ) { + $('html, body').animate({ + scrollTop: errorNotice.offset().top - 100 + }, 300); + } + }); + $('#simple-contact-form-id; ?>').on('submit', function (e) { e.preventDefault(); var formData = new FormData(this); From 4b050f35c26d637277f3268d7f2736804dbad79b Mon Sep 17 00:00:00 2001 From: Akash Date: Thu, 27 Aug 2020 12:02:40 +0530 Subject: [PATCH 5/7] Added Custom template loading functionality Co-Authored-By: Hitesh Aggarwal <5124120+hiteshaggarwal@users.noreply.github.com> --- helper.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helper.php b/helper.php index 1a2d042..955e58a 100644 --- a/helper.php +++ b/helper.php @@ -53,7 +53,10 @@ public static function getLabelText($field) { public static function getFieldLayout($type) { $return = ''; - if (file_exists(JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts/fields/' . $type . '.php')) { + if (file_exists(JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts/fields/' . $type . '-custom.php')) { + // For adding custom files + $return = $type . '-custom'; + } else if (file_exists(JPATH_SITE . '/modules/mod_jdsimplecontactform/layouts/fields/' . $type . '.php')) { $return = $type; } else { $return = 'text'; From 2f24787518d243c002dc853444e81067d254183d Mon Sep 17 00:00:00 2001 From: Akash Date: Fri, 20 Nov 2020 10:59:05 +0530 Subject: [PATCH 6/7] Added Browse Button Language --- language/en-GB/en-GB.mod_jdsimplecontactform.ini | 3 ++- language/nl-NL/nl-NL.mod_jdsimplecontactform.ini | 3 ++- layouts/fields/file.php | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/language/en-GB/en-GB.mod_jdsimplecontactform.ini b/language/en-GB/en-GB.mod_jdsimplecontactform.ini index e2d2800..a81e05c 100644 --- a/language/en-GB/en-GB.mod_jdsimplecontactform.ini +++ b/language/en-GB/en-GB.mod_jdsimplecontactform.ini @@ -100,7 +100,8 @@ MOD_JDSCF_NUMBER_MIN_LENGTH_ERROR="%s should have %s characters or more." MOD_JDSCF_NUMBER_MAX_LENGTH_ERROR="%s should have %s characters or fewer." MOD_JDSCF_NUMBER_MIN_ERROR="%s should be greater than or equal to %s." MOD_JDSCF_NUMBER_MAX_ERROR="%s should be lower than or equal to %s." -MOD_JDSCF_FILE_BTN_LBL="Choose file" +MOD_JDSCF_FILE_LBL="Choose file" +MOD_JDSCF_FILE_BTN_LBL="Browse" MOD_JDSCF_MIN_LENGTH_LBL="Min Length" MOD_JDSCF_MIN_LENGTH_DESC="Enter a number if you'd like to limit the field input to a minimum number of chracters." diff --git a/language/nl-NL/nl-NL.mod_jdsimplecontactform.ini b/language/nl-NL/nl-NL.mod_jdsimplecontactform.ini index 9c9b165..71ce2e6 100644 --- a/language/nl-NL/nl-NL.mod_jdsimplecontactform.ini +++ b/language/nl-NL/nl-NL.mod_jdsimplecontactform.ini @@ -99,7 +99,8 @@ MOD_JDSCF_NUMBER_MIN_LENGTH_ERROR="%s moet %s karakters of meer hebben." MOD_JDSCF_NUMBER_MAX_LENGTH_ERROR="%s moet %s karakters of minder hebben." MOD_JDSCF_NUMBER_MIN_ERROR="%s moet groter of gelijk zijn aan %s." MOD_JDSCF_NUMBER_MAX_ERROR="%s moet kleiner of gelijk zijn aan %s." -MOD_JDSCF_FILE_BTN_LBL="Kies een bestand." +MOD_JDSCF_FILE_LBL="Kies een bestand." +MOD_JDSCF_FILE_BTN_LBL="Browse" MOD_JDSCF_MIN_LENGTH_LBL="Minimale Lengte" MOD_JDSCF_MIN_LENGTH_DESC="Vul een nummer in als je een wilt dat een veldwaarde een minimaal aantal karakters moet hebben." diff --git a/layouts/fields/file.php b/layouts/fields/file.php index 37fe46a..07b383d 100644 --- a/layouts/fields/file.php +++ b/layouts/fields/file.php @@ -26,17 +26,20 @@ $style = '.filesize-err {' . 'display: none;' . 'margin-top: 10px;' + . '}' + . '.custom-file-label::after {' + . 'content: "' . JText::sprintf('MOD_JDSCF_FILE_BTN_LBL') . '" !important;' . '}'; $document->addStyleDeclaration($style); ?>
" type="file" name="jdscf[name; ?>]" class="custom-file-input" > - +
- File size is too big! + File size is too big!
From 861175c0d88d42f39ca90184bfef6f00831777a9 Mon Sep 17 00:00:00 2001 From: Hitesh Aggarwal Date: Wed, 2 Dec 2020 14:03:18 +0530 Subject: [PATCH 7/7] Minor Fixes for WCAG --- layouts/field.php | 13 ++++++------- layouts/fields/calendar.php | 1 + layouts/fields/checkbox.php | 2 +- layouts/fields/file.php | 1 + layouts/fields/text.php | 1 + layouts/fields/textarea.php | 1 + layouts/label.php | 4 +++- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/layouts/field.php b/layouts/field.php index e2e2f45..91f3543 100644 --- a/layouts/field.php +++ b/layouts/field.php @@ -1,4 +1,5 @@ show_label === null ? 1 : $field->show_label; -if ($field->type == 'hidden' ) { +if ($field->type == 'hidden') { echo $input; } else { ?> -
-
- +
+
- - + +
-
\ No newline at end of file diff --git a/layouts/fields/calendar.php b/layouts/fields/calendar.php index e6772dc..fab4386 100644 --- a/layouts/fields/calendar.php +++ b/layouts/fields/calendar.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; extract($displayData); $attrs = []; +$attrs[] = 'id="' . $field->id . '"'; if (isset($field->placeholder) && !empty($field->placeholder)) { $attrs[] = 'placeholder="' . $field->placeholder . '"'; } diff --git a/layouts/fields/checkbox.php b/layouts/fields/checkbox.php index 519f850..e12b73d 100644 --- a/layouts/fields/checkbox.php +++ b/layouts/fields/checkbox.php @@ -10,7 +10,7 @@ extract($displayData); $options = ModJDSimpleContactFormHelper::getOptions($field->options); $attrs = []; - +$attrs[] = 'id="' . $field->id . '"'; if ($field->required) { $attrs[] = 'required'; if (isset($field->custom_error) && !empty(trim($field->custom_error))) { diff --git a/layouts/fields/file.php b/layouts/fields/file.php index 07b383d..145e2ee 100644 --- a/layouts/fields/file.php +++ b/layouts/fields/file.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; extract($displayData); $attrs = []; +$attrs[] = 'id="' . $field->id . '"'; if ($field->required) { $attrs[] = 'required'; if (isset($field->custom_error) && !empty(trim($field->custom_error))) { diff --git a/layouts/fields/text.php b/layouts/fields/text.php index 0a99374..9f4befd 100644 --- a/layouts/fields/text.php +++ b/layouts/fields/text.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; extract($displayData); $attrs = []; +$attrs[] = 'id="' . $field->id . '"'; switch ($field->type) { case 'email': $attrs[] = 'data-parsley-type="email"'; diff --git a/layouts/fields/textarea.php b/layouts/fields/textarea.php index 5196933..f0ea123 100644 --- a/layouts/fields/textarea.php +++ b/layouts/fields/textarea.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; extract($displayData); $attrs = []; +$attrs[] = 'id="' . $field->id . '"'; if ($field->required) { $attrs[] = 'required'; if (isset($field->custom_error) && !empty(trim($field->custom_error))) { diff --git a/layouts/label.php b/layouts/label.php index 9c2b580..4f12761 100644 --- a/layouts/label.php +++ b/layouts/label.php @@ -1,4 +1,5 @@ show_label === null ? 1 : $field->show_label; ?> -