Bug:https://github.com/VLCTechHub/VLCTechHub-site/issues/95#112
Bug:https://github.com/VLCTechHub/VLCTechHub-site/issues/95#112Eliandromeda wants to merge 1 commit intoVLCTechHub:mainfrom
Conversation
Added validation with regular expression on salary field
|
|
||
| let $form = $E('#new-job form') | ||
| $form.querySelector('button[data-type="submit"]').addEventListener('click', submitEvent) | ||
| $E('#new-job #salary').addEventListener('change', removeWhiteSpaces) |
There was a problem hiding this comment.
Hi @Elimystery, thanks for your contribution. In our site when creating a new job, we would like to force entering a value for salary, with a least a number on the text (I think your regular expression is matching something more concrete than that).
So values that are ok:
- "10K"
- "Entre 20.000 y 30.000"
Values that are not ok:
- ""
- "Según la experiencia del candidato"
In the site, we are not using javascript validations, but relying on html5 inputs instead. So we could use an input with a pattern and a title as shown here: https://webdesign.tutsplus.com/tutorials/html5-form-validation-with-the-pattern-attribute--cms-25145
In the project, they are created here: https://github.com/VLCTechHub/VLCTechHub-site/blob/master/templates/macros/form.njk#L1 and maybe we could create a patternTextInput component.
In this case, the value for the title would be "Introduce un rango salarial válido".
If you feel like trying that approach, feel free to contribute with this info in mind.
Thanks!
b274155 to
47305eb
Compare
Added validation with regular expression on salary field