Last active
November 8, 2016 14:03
-
-
Save matthewbeta/700713eeeb6444d206d5 to your computer and use it in GitHub Desktop.
Add a custom validator to Parsley (which works unlike the docs) From https://docs.typo3.org/typo3cms/extensions/powermail/ForDevelopers/WriteOwnValidators/ClientsideValidation/Index.html
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
<input type="text" data-parsley-multiple="3" data-parsley-error-message="Please try again" /> | |
/*...*/ | |
<script type="text/javascript"> | |
window.ParsleyValidator | |
.addValidator('multipleof', function (value, requirement) { | |
return 0 === value % requirement; | |
}, 32) | |
.addMessage('en', 'multipleof', 'This value should be a multiple of %s'); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment