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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:20:53+00:00 2026-06-17T17:20:53+00:00

I have a page that has 6 forms that all have a value with

  • 0

I have a page that has 6 forms that all have a value with the same name ‘audit_id_upload’. Currently I have one of them being validated (I’m just looking for empty values) with…

function validateForm()
{
var x=document.forms["audit_upload"]["audit_id_upload"].value;
if (x==null || x=="")
  {
  alert("Please Select an Audit");
  return false;
  }
}
</script>

Can I adapt this to validate the other forms as well without having to repeat it 5 more times?

Thanks

  • 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-17T17:20:54+00:00Added an answer on June 17, 2026 at 5:20 pm

    Since you have a input element with audit_id_upload in every form, you could pass the name of your form to this function and use it to validate the item.

    function validateForm(fName)
    {
       var x=document.forms[fName]["audit_id_upload"].value;
       if (x==null || x=="")
       {
          alert("Please Select an Audit");
          return false;
       }
       return true;
    }
    

    and call it on the for onSubmit event.

    <form name='f1' onsubmit="return validateForm('f1')">
    
    </form>
    
    <form name='f2' onsubmit="return validateForm('f2')">
    
    </form>
    
    <form name='f3' onsubmit="return validateForm('f3')">
    
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django project that, on one page, has multiple forms (in different
I have a page that sends emails to customers. It has a send all
I am working on a webpage where I have a main landing-page that has
I have a page that loads a complicated set of forms. In this set
I'm currently working on a minimal shop(-ish) script that has to deal with a
I have an application that I am currently writing that works by iterating through
I have a textarea that I am trying to validate whether someone has filled
I have a page, it has a drop down list, which contains the names
I have a php page to capture sales orders. it has a dependant drop
I have a page on which I am ajax-ing in a table which has

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.