Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug:https://github.com/VLCTechHub/VLCTechHub-site/issues/95 #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Eliandromeda
Copy link

Added validation with regular expression on salary field

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants