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 8940981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:11:20+00:00 2026-06-15T11:11:20+00:00

It has to be a minor issue but I just can’t find it. Maybe

  • 0

It has to be a minor issue but I just can’t find it. Maybe one of you can help me here.

Javascript

  function white_space(field)
  {
     field.value = field.value.replace(/^\s+/, "");
  }
  function validate(){
    var formname=document.reg_form;
    var fname=formname.fname.value;
    var mess="";

  var uname=formname.prodName.value;
    if(uname==""){
    mess= mess+"User Name cannot be blank\n";

    }
   var pass=formname.prodPrice.value;
    if(pass==""){
     mess= mess+"Password cannot be blank\n";   
}

if(mess){
  alert(mess);
  return false;

   }
 }

HTML FORM

 <form class="form-signin" action="#" onSubmit="return validate();" name="reg_form">
    <h2 class="form-signin-heading">Sign-In</h2>
    <input type="text" class="input-block-level" name="prodName" placeholder="Email address" onKeyPress="white_space(this)">
    <input type="password" class="input-block-level" name="prodPrice" placeholder="Password" onKeyPress="white_space(this)">
    <label class="checkbox">
      <input type="checkbox" value="remember-me"> Remember me
    </label>


    <button class="btn btn-large btn-primary" type="submit">Sign in</button>
  </form>

Error

enter image description here

Browser doesn’t show an empty string error.

  • 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-15T11:11:21+00:00Added an answer on June 15, 2026 at 11:11 am

    in your case this line

    var fname=formname.fname.value;
    

    throw error while execution validate function, as there is no element with fname into the form, comment it and you are fine
    http://jsbin.com/oxawil/1

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

Sidebar

Related Questions

Not sure if this is just a minor configuration issue or otherwise, but when
while PhotoSwipe has been fantastic so far just these minor issues that I can't
I've gone through just about every property I can think of, but haven't found
Our team has recently been considering pushing out a minor registry fix to users
I want to build a NSIS-script, which has three section section Main section Minor
Has anyone ever run into this issue before? Sometimes the string displays, sometimes half
Has the asp.net mvc team implemented a default model binding for enums? One that
I'm having a minor css issue. I have a series of layered divs and
One issue that comes up during Pinax development is dealing with development versions of
I'm running into a minor issue with some ASP.Net code I'm working on. For

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.