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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:00:18+00:00 2026-05-29T10:00:18+00:00

Can anyone advise where I’m going wrong with my form validation below? Basically if

  • 0

Can anyone advise where I’m going wrong with my form validation below?

Basically if the names variable doesn’t contain anything I want the input box to display ‘please enter your name’, but if they resubmit and still haven’t added a name I need the if statement to pick up the phrase and still not validate.

Its driving me nuts – any help gratefully received!

Cheers
Paul

 if((names.length == 0) || (names != 'Please Enter Your Name')){  
        var error = true;  
        $('.error').fadeIn(500);  
        $('.nStar').fadeIn(500);
        $('#name').val('Please Enter Your Name');

    }else{  
        setTimeout("errorOut()",1000);
        $('.nStar').fadeOut(500);

    }  
  • 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-05-29T10:00:19+00:00Added an answer on May 29, 2026 at 10:00 am

    Your if statement is checking if the value of the input is not Please Enter Your Name. I believe you want to check if it is.

    This line:

    if((names.length == 0) || (names != 'Please Enter Your Name')){ 
    

    Should change to:

    if((names.length == 0) || (names == 'Please Enter Your Name')){ 
    

    This is assuming that the names variable consists of the input element’s value.

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

Sidebar

Related Questions

Can anyone advise me on customising the Add Block form? (/admin/build/block/add) I want to
Can anyone advise me on how the border below the navigation bar can be
Can anyone advise what is the best way of client and server side validation.
Can anyone advise on the appropriate SAS informat to read in a datetime (dd/mm/yyyy
Can anyone advise? And how does the replace all method works? message = message.replaceAll((?:https?|http?)://[\\w/%.\\-?&=!#]+,
Can anyone advise of AIX system calls that can be used to programatically check
Can anyone advise if its possible to pass data via jQuery to an ASP.NET
Can anyone advise on how to convert a timespan or int to an ISO8601
can anyone advise how i would convert a date like Tuesday, 22 June, 2010
Can anyone advise why this line of code would not compile? It generates CS1660

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.