Results 1 to 4 of 4

Thread: Validating 8 form fields with Javascript

  1. #1
    Join Date
    Jan 2014

    Validating 8 form fields with Javascript

    Hi all,

    I know this has probably been covered before ...

    I need to validate 8 seperate inputs in an HTML form using JS. I think I have got my regular expressions sorted I just need to bolt them to getElementById function. This is where I am having a brain freeze. Can anyone help me out, the first thing to validate is a 5 digit number between 0 and 99999 and not 00000


  2. #2
    Join Date
    Jan 2014
    Oh and I would like to alert to errors not with alert boxes but with a message on the page

  3. #3
    Join Date
    Mar 2007
    Perhaps a bit of code for others to look at can help...
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  4. #4
    Join Date
    Jan 2014
    I have got my number fields sorted I am struggling with date and time fields. I need to test a date in the format DD-MM-YYYY and a time in the format HH:MM:SS here is what I am trying

    /* validate Date Date */
    function validateDate() {
    var z = document.getElementById('Date').value;
    if (/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/) return true;

    else {
    document.getElementById('Date').value= "";
    setTimeout(document.getElementById('Date').focus, 50);
    return false;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles