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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:12:14+00:00 2026-06-12T15:12:14+00:00

I know there is another question about this here but this just isn’t working

  • 0

I know there is another question about this here but this just isn’t working for me.

So I have a very very large form with about 40 fields and its a pain to go trough each field individually, so I divided the 50 fields into categories and asigned an id to each input categories, so for example, there are 10 prices fields for 10 quantities on 4 categories: Standard shipping, express shipping, rush shipping, super rush shipping. so I named all of the prices under one category with the same id, say for example standard shipping is

<id input type="text" name="s_qty_25" id="s_cf" />
<id input type="text" name="s_qty_50" id="s_cf" />
<id input type="text" name="s_qty_100" id="s_cf" />
.... and so on

my form is defined like this:

<form method="post" id="creation_form" action="actions/add_prices.php">
  ....
</form>

and the jQuery I use to validate is like this:

$(function() {
$('#creation_form').submit(function(e){

    $("#cs_f").each(function(index, obj){
        var cs_f_val = $(obj).val();
        if(cs_f_val == ''){
            $(obj).attr('style', 'background:red;');
            valid = false;
        }
    });

    //...repeat the snipet for each 3 remaining price groups

    return valid;
});
});

basically turn the fields red if empty and cancel submition. however only the first field will get its red background!

Thanks for the help folks 🙂

  • 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-12T15:12:15+00:00Added an answer on June 12, 2026 at 3:12 pm

    There should only be one field with a particular id. That’s why it’s called an id!

    Try using a class instead:

    <id input type="text" name="s_qty_25" class="s_cf" />
    <id input type="text" name="s_qty_50" class="s_cf" />
    <id input type="text" name="s_qty_100" class="s_cf" />
    

    then

    $(".cs_f").each
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about this question . I posted a reply there but
I know there is a wiki page about it , but since I'm very
Here I am with another question, this time about the youtube API. I'm using
I know there are a LOT of this question on here. I took a
I know there is a lot on this topic but I can't get any
I know there are a lot of questions around on this subject, but I've
Another slightly non-technical question, but I couldn't decide whether to ask here or on
Alright, I know questions like this have probably been asked dozens of times, but
This is an offshoot question that's related to another I asked here . I'm
This is my first time asking a question on here. It has been very

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.