-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Update JavaScript for upcoming powermail version 10
- Loading branch information
1 parent
a22a1c0
commit d5ab72c
Showing
4 changed files
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
/** | ||
* <input type="text" data-parsley-custom100="1" data-parsley-error-message="Please try again" /> | ||
* <input type="text" data-powermail-custom100="80000" data-powermail-error-message="Please try again" /> | ||
*/ | ||
window.Parsley.addValidator( | ||
'custom100', function (value, requirement) { | ||
if (value >= 80000) { | ||
return true; | ||
const forms = document.querySelectorAll('.powermail_form'); | ||
forms.forEach(function(form) { | ||
let formValidation = form.powermailFormValidation; | ||
|
||
formValidation.addValidator('custom100', function(field) { | ||
if (field.hasAttribute('data-powermail-custom100')) { | ||
return field.value < parseInt(field.getAttribute('data-powermail-custom100')); | ||
} | ||
return false; | ||
}, 32) | ||
.addMessage('en', 'custom100', 'Error'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters