Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7953657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:12:36+00:00 2026-06-04T03:12:36+00:00

Would someone a little smarter than myself be able to help me with this

  • 0

Would someone a little smarter than myself be able to help me with this function? Its purpose is to validate a text input in a form, a phone number field that will only accept 0-9, dash and dot. The HTML calls the function fine.

function validateFeedback() {
    var phone = document.getElementById("phone");
    var validNumber = "0123456789.-";
    for (i = 0; i < phone.length; i++); {
        if (validNumber.indexOf(phone.charAt(i)) == -1); {
            alert("You have entered an invalid phone number");
            return false;
        }
    }
    return true;
}

Thanks so much for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:12:37+00:00Added an answer on June 4, 2026 at 3:12 am

    Regular expressions should help 😉

    I’m sorry I haven’t tried to run this code, but it should be OK.

    function validateFeedback(){
        var phone = document.getElementById("phone");
        var RE = /^[\d\.\-]+$/;
        if(!RE.test(phone.value))
        {
            alert("You have entered an invalid phone number");
            return false;
        }
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would someone be able to help here? I would like to fill a div
would someone be able to help me with a button to clear /delete the
I'm rubbish at regular expressions, so would someone be able to help me find:
I would like to know some way to do this, maybe someone can help
if someone could help on the following would appreciate this as I spent the
would someone please write this code: this.Loaded += (s, e) => this.loaded = true;
Would someone be able to break down the Ruby specifics of what each of
I would like to be able to generate these bellcurves from very little data:
Please would someone who understands VBA Arrays (Access 2003) help me with the following
This situation happens a little often, your whole repository has 2MB and then someone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.