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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:20:39+00:00 2026-06-07T18:20:39+00:00

I have a section on a form where I need the validator to check

  • 0

I have a section on a form where I need the validator to check the value of one input against the sum of two other inputs. I do not know how to write javascript syntax correctly, so I apologize if this is worded incorrectly.

<form id="RSVP-form">

<label> Number of Guests </label>
<input type="number" name="ppl-number" required="required" size="4" maxlength="2" />

<label> Chicken Marsala </label>
<input type="range" name="chicken" min="0" max="10" value="0" />

<label> Steak and Salmon </label>
<input type="range" name="steak" min="0" max="10" value="0" />

<button type="submit">Submit RSVP</button>

</form>

I need to write a script that will confirm value(“ppl-number”) = value(“chicken”+”steak”). Not sure how to go about doing that? I’ve looked at several examples but can’t seem to get a script to function properly after several attempts.

Thanks in advance!

  • 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-07T18:20:41+00:00Added an answer on June 7, 2026 at 6:20 pm

    Use something like this:

    <script>
    function validatecount()
    {
        var chicken_count = document.getElementById("chicken").value;
        var steak_count = document.getElementById("steak").value;
        var total = document.getElementById("ppl-number").value;
        var sum = parseInt(chicken_count) + parseInt(steak_count);
        alert(sum);
        alert(total);
        if (sum == total)
        {
        document.RSVP-form.submit();
        } else {
            alert("Error Message!");
        }
    }
    </script>
    <form id="RSVP-form">
    
        <label> Number of Guests </label>
        <input type="number" name="ppl-number" id="ppl-number"
               required="required" size="4" maxlength="2" />
    
        <label> Chicken Marsala </label>
        <input type="range" name="chicken" id="chicken" min="0" max="10" value="0" />
    
        <label> Steak and Salmon </label>
        <input type="range" name="steak" id="steak" min="0" max="10" value="0" />
    
        <button type="submit" onclick="validatecount()">Submit RSVP</button>
    
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new in .net.I need help. I have 2 forms one form has
I have 11 checkboxes in my HTML form and already have a section in
As you can see in the Form Widgets section, I don't have a EditText
I have a form with a secondary address section. In this section you can
within a form I have a section that allows the user to build out
I just have a question about putting a single form with multiple inputs into
I have the following structure to XML file: <INSTANCE> <Sections> <Section> <Forms> <Form> <Control
I have a two tables (actually sets of tables) which may need to be
Need: Ability to dynamically build Forms Structure (simple idea not actual structure) Admin: Form
I have created a dynamic form using jQuery that has two sections, once the

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.