Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

76
Views
Ignoring non required field

I am trying to get my code to ignore a specific field that doesn't require text at all, but if it has anything other than numeric values in it, it will give me an error. Instead, it gives me the errors when Nothing is entered. The code I have in question is a regex function for checking numeric value, my validation function calls to the numeric regex function, and if

input.classList.contains "numeric".

If the regex is not validated, it will give an error.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your regex /^([0-9])+$/ in checkNumeric() expects at least one digit because of the +. Try /^([0-9])*$/. This accepts empty string as well, because * matches 0 til infinity digits.

EDIT: I created a program showing the regex in action.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!