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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:26:14+00:00 2026-06-01T19:26:14+00:00

I have some input HTML elements which I want to validate whether they are

  • 0

I have some input HTML elements which I want to validate whether they are filled up or not. Basically, they are mandatory. I am doing something like this:

    var displayNames new Array();
    displayNames[0] = "Name";
    displayNames[1] = "Address";
    displayNames[2] = "Age";

function validForm() {
    var Name = document.getElementById(txtName).value;
    if(!Name) {
      alert(displayName[0] is required);
    }}

How should I make the validations easy in JS?

  • 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-01T19:26:16+00:00Added an answer on June 1, 2026 at 7:26 pm

    How should I make the validations easy in JS?

    It depends. Are they all strings? Or can some be numbers? Or some in need of a regex (like an email address)? Heck, can some even be an empty string or blank?

    If we are talking about less than 12 fields, then I would consider rolling my own validation. However, if we are talking a lot of fields spread across multiple pages and projects then I would consider using the a validation plugin such as http://bassistance.de/jquery-plugins/jquery-plugin-validation/

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

Sidebar

Related Questions

I have some HTML like this: <input type=radio class=MyRadio name=TheName> <label for=TheLabel>the text</label> How
i have one form which have some input box and some select box. i
I have some data (which users input using WYSIWYG editor). I have created a
I have some input like this: aaaaa bbb \n cccccc\n ddddd \neeee And I
In the settings.php i have some input for the realname,hobby,city and select tag for
I have some bison grammar: input: /* empty */ | input command ; command:
I have some long running scripts with breaks requiring input/interaction to continue but when
I have a View where some input text to be added dynamica using jquery,
I have a form with some input texts passed in GET, and i don't
I have some code bound to the blur() event in jQuery: $('input[type=text]').blur(function () {

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.