A brand new useless library
Allowing your team to create in a simple way many error messages for your forms.
Have you ever wanted to display an evolving error message, as the user would type wrong things in your forms? For instance, going from "The email is invalid" to "Please use your brain and type a valid email" in 3.5?
I have. And now there is CrescendoJS, a simple library to allow me to do that (and you too). What a time to be alive.
npm install crescendojs --save# oryarn add crescendojs
In your app, initialize a Crescendo object by passing what is called a
CrescendoInitOpt object. A
CrescendoInitOpt object contains a
CrescendoCategories object and a
const options =categories:emailFormat:'The email is invalid''The email is still invalid''Please use your brain and type a valid email'emptyValues:'This field is mandatory, please specify a value''What part of "mandatory" do you not understand?''Are you for real? This field is m a n d a t o r y.'// the registering property is optional// and you don't have to register everything at initregistering:// you specify for which category you want to register the form control// you specify the form control id// you specify if you want the error message to be hidden when the user starts typing again (default is true)emailFormat: elemId: 'email' hideOnInput: true
Then, you init a crescendo object:
;const crescendo = ;
You can register as many elements as you want:
Then, you want to display an error message:
You can find some examples in the "examples" folder. To compile them, clone the project and then launch
- allow users to load JSON files;
- allow users to erase all errors for an element.