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

  • Home
  • SEARCH
  • 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 8981039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:14:03+00:00 2026-06-15T20:14:03+00:00

This javascript form validation is not working in IE8 !! the form submits while

  • 0

This javascript form validation is not working in IE8 !!
the form submits while the user inters invalid inputs.
it is working properly in other browsers firefox ,opera, chrome.
can you help me please?

<form method="post" name="form1" id="form1" action="editAction.php" onsubmit="return check_user_info()">

===============================

<script type="text/javascript">

    function check_user_info()
    {
    var proceed = true;
         if (checkUserFirstName() == 1)
        {
        document.getElementById("userFname_msg").style.display = "block";
        document.getElementById("userFname_msg1").style.display = "none";
        proceed = false;
        }
        else if (checkUserFirstName() == 11)
            {
            document.getElementById("userFname_msg1").style.display = "block";
            document.getElementById("userFname_msg").style.display = "none";
            proceed = false;
            }
            else
            {
            document.getElementById("userFname_msg").style.display = "none";
            document.getElementById("userFname_msg1").style.display = "none";
            }   
            //-----------------------------
          if (checkUserLastName() == 1)
        {document.getElementById("userLname_msg").style.display = "block";
        document.getElementById("userLname_msg1").style.display = "none";
        proceed = false;}
        else if (checkUserLastName() == 11)
            {document.getElementById("userLname_msg1").style.display = "block";
            document.getElementById("userLname_msg").style.display = "none";
            proceed = false;}

        else{document.getElementById("userLname_msg").style.display = "none";
            document.getElementById("userLname_msg1").style.display = "none";
            }   
            //-----------------------------

            if (checkMobile() == 1)
        {
        document.getElementById("mobile_msg").style.display = "block";
        proceed = false;
        }
        else
        document.getElementById("mobile_msg").style.display = "none";


            //----------------------------------
                if (checkPhone() == 1)
        {
        document.getElementById("phone_msg").style.display = "block";
        proceed = false;
        }
        else 
        document.getElementById("phone_msg").style.display = "none";

            //----------------------------
            if (proceed)
            {
            alert ("your information has been updated successfully ..");
            return proceed; 
            }
            else
            {
            return false;
            }
      } // End function ...
     //----------------------------------------------------
      function checkUserFirstName()
      {
      if (document.getElementById("firstName").value.trim().length == 0) 
      return 1 ;
      else if (!(document.getElementById("firstName").value.match(/^[ \.\-_a-zA-Z]+$/)))
      return 11 ;
      } // End function ...
      //--------------------------------------------------
      function checkUserLastName()
      {
      if (document.getElementById("lastName").value.trim().length == 0) 
      return 1 ;
      else if (!document.getElementById("lastName").value.match(/^[ \.\-_a-zA-Z]+$/))
      return 11 ;
      } // End function ...
    //------------------------------------------------------------- 
      function checkMobile()
    {
    if (((document.getElementById("mobile").value.trim().length >0) && (document.getElementById("mobile").value.trim().length != 10))|| (isNaN(document.getElementById("mobile").value)))
    return 1 ;

    } // end function ...
    //----------------------------------------------------------
      function checkPhone()
    {
    if(!document.getElementById("TelephoneNumber").value.match(/^[ \/0-9]*$/))
    return 1 ;
    } // end function ...
    </script>
  • 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-15T20:14:04+00:00Added an answer on June 15, 2026 at 8:14 pm

    I’m guessing the problem is probably because of the .trim() method on the strings in your check functions. There isn’t a String trim method in older browsers, you’d have to use a polyfill to make sure it’s always available, no matter the browser. A good example is:

    Trim string in JavaScript?

    "".trim || String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');};
    

    is what I use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This javascript code does not work in IE8, but works in Firefox and Google
I have a relatively simple HTML / JavaScript form. Such as this: <form method='POST'
Given this HTML: <form id=formx> <input type=text value= /> </form> And this JavaScript: $(function()
Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
I am trying to use an HTML form and javascript (i mention this, because
I'm using a javascript function to submit my form. This works in every browser
I've used the exact files from this tutorial: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/ The ideea is to submit
<form name=vegForm action=veg.aspx > <select onchange='this.form.submit()'> <script type=text/javascript> for (i = 0; i <
i'll try and be as clear as possible. I'm working on some form validation
I have Validation working across a large form (I fire it several times before

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.