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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:49:01+00:00 2026-05-25T10:49:01+00:00

I’m looking at creating a very simple HTML page that contains an HTML form

  • 0

I’m looking at creating a very simple HTML page that contains an HTML form with a series of check boxes and input fields. The page would be roughly like so:

Input Forename ==== Input Surname ==== Input ID =====
Text checkbox1 value1 Text
Text checkbox2 value2 Text
Text checkbox3 value3 Text
Text checkbox4 value4 Text
Output Text value
Output Text value
Output Text value
Output Text value

Depending on which values are ticked (i.e. value 1/2/3/4), the value next to it is then calculated (for arguments sake let’s say it’s multiplied by 2) and then output below (where it says “Output text” value). Apologies if this doesn’t match the “question” but you see what I mean by “collecting” data (i.e. the value next to the checkbox).

My question is thus, is it possible to use JavaScript to say, if tickbox1 is checked, please use “value1”? Once this is all completed the page just needs to have a “print” button (which is fine). There is no back end stuff that needs to happen and no data capture.

Hope this makes sense and thanks in advance

EDIT:Of course if it’s a lot easier to do this with something like JQuery I’d be happy to explore this!

  • 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-05-25T10:49:01+00:00Added an answer on May 25, 2026 at 10:49 am

    This code should help you out!

    Questions[] is an array with all the input fields in,
    getElementsByName goes through all the elements that have the same name (radio boxs for example all have the same name) and then finds out which one is checked, and then uses that value.

    Answers[] is the array with the stored values in.

    for (var i = 0; i < questions.length; i++) {
    
        //Does the question name have more than one instance? (That would make it a checkbox or radio button...
        if (document.getElementsByName(questions[i]).length > 1) {
            //Lets loop through all these values and find out which one is selected, and then grab the value from it.
            var x = document.getElementsByName(questions[i])
                for(var k=0;k<x.length;k++)
                if(x[k].checked){ //This is where it loops to find the checked answer
                        answers[i] = x[k].value;
                //alert("radio saved " + answers[i]);
                }
        }
        //Nope, only once, so its a text field or similar
        else {
            answers[i] = document.getElementById("answer" + questions[i]).value;
            //alert("text saved " + answers[i]);
        }
    }
    

    Hope this helps!

    So to use this in your calculations (to say make it double) you could call

    var answertoyourquestion = answers[i] + answers[i];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I'm looking for suggestions for debugging... If you view this site in Firefox or
I have a jquery bug and I've been looking for hours now, I can't
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.