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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:00:29+00:00 2026-06-13T21:00:29+00:00

I need help with the coding of a custom function that I need to

  • 0

I need help with the coding of a custom function that I need to do.

The concept is simple : I offer the customer a list of ~20 products and then I ask them to select 5 products from the entire list using checkboxes.

And while they do select the products, it needs to update an hidden input so I will be able to insert it in my database.

We could be starting with something like this : http://jsfiddle.net/9mxh5/ but it only needs to be work so I can only select a number of checkboxes.

Here is some code we could use too

<input type="checkbox" name="products" value="product1" onChange="javascript:updateProducts();"/>
<input type="checkbox" name="products" value="product2" onChange="javascript:updateProducts();"/>
<input type="checkbox" name="products" value="product3" onChange="javascript:updateProducts();"/>
<input type="checkbox" name="products" value="product4" onChange="javascript:updateProducts();"/>

<!-- Hidden -->
<input type="hidden" name="myFiveProducts" value="THELIST" />

I have used the jsfiddle up there and adapt it like I would like to do : http://jsfiddle.net/ENxnK/15/

Thx in advance for your help.

  • 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-13T21:00:31+00:00Added an answer on June 13, 2026 at 9:00 pm

    I’ve given condition for 3. You can change it to 5 and i think you can assign your hidden variable by yourself. If i can’t then let me know . I’ll update it

    <script type="text/javascript">
    var i=0;
        function updateProducts(myid)
    {
    
        if(document.getElementById(myid).checked==true)
        {i=i+1;
    
        if(i==3)
        {
        document.getElementById("products1").disabled="disabled";
        document.getElementById("products2").disabled="disabled";
        document.getElementById("products3").disabled="disabled";
        document.getElementById("products4").disabled="disabled";
        }
        }
        else
        i=i-1;
    }
    </script>
        <div id="mydiv">
    <input type="checkbox" id="products1" value="product1" onChange="javascript:updateProducts(this.id);"/>
    <input type="checkbox" id="products2" value="product2" onChange="javascript:updateProducts(this.id);"/>
    <input type="checkbox" id="products3" value="product3" onChange="javascript:updateProducts(this.id);"/>
    <input type="checkbox" id="products4" value="product4" onChange="javascript:updateProducts(this.id);"/>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help in coding this in C# I have a list of
I have a coding/maths problem that I need help translating into C#. It's a
I need help with some coding. I need to get a list of All
I need help with a loop... it's probably simple but I'm having difficulty coding
The coding below seperates the $state data, I need help putting the var_dump info
Core Question I need help coming up with a concept to achieve my goal.
Need help, function getFamily() { FB.api('/me/family', function(response) { alert(JSON.stringify(response)); }); } With the above
Need help with a query that I wrote: I have three tables Company id
I am new to python and coding in general and I need help with
I'm quite new with PHP and need help coding an add script for my

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.