Multiply Values From Checkbox Selections
Jun 17, 2011
I am in the process of developing a calculator for some of my colleagues to use. One of the variables within the calculations is called PMH. I want to determine the value of PMH based on which checkboxes are ticked. Each checkbox has a different value. If the checkbox is not ticked, then the value of each option is 1 and obviously more than one checkbox may be ticked.
I have created the checbox code:
<td><input type="checkbox" name="PMH" value="1.6" /> Smoker<br />
<input type="checkbox" name="PMH" value="0.4" /> CCF<br />
<input type="checkbox" name="PMH" value="0.5" /> Pulmonary Oedema / Cirrhosis<br />
<input type="checkbox" name="PMH" value="0.8" /> COAD<br /></td>
But I have no idea on how to calculate what I need for var PMH.
View 4 Replies
ADVERTISEMENT
Sep 29, 2010
My problem is that I have a table where I show products and costs, then when I entry the amount other cell be updated with the overall
For example:
The amount is entried for the user, it's a textfield
For example I have this code, but doesn't work good
See this page -> [url]
View 3 Replies
View Related
Oct 31, 2011
I keep getting 28 when I am suppose to get 22 because of Order of Operations.
<html>
<head>
<title>Movie</title>[code]............
View 15 Replies
View Related
Jun 2, 2010
I work in html and am minimally familiar with JS but am working with someone's code that uses form checkboxes to select options for hrefs in a decision tree. Given 5 options, selecting option1 takes you to page_x, option2 to page_y, etc. Users need option for selecting option1 AND option3, for example, to go to page_k.Is there a way in JS to take:
if(document.form1.A6.checked == true)
{
alert("A6 is selected")
[code]....
View 14 Replies
View Related
Mar 22, 2011
I am trying to have it save menu selections, I was thinking either cookies or storing it in the window thing but I am unsure of how to do these.
HTML Code:
<script type="text/javascript">
function setCookie(c_name,value,exdays) {
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
} .....
View 15 Replies
View Related
Jun 11, 2011
I am looking to build an expenditure calculator. What I am having problems with is I am using radio buttons to multiply form field values
[radio1] = x 1 (week)
[radio2] = x 4 (month)
[radio3] = x 52 (year)
So if you fill out a field and select [radio2] it multiplies the field by 4. If you then select [radio1] it reverts to the original value. Using JQuery what's the best way to do this. The issue I am having is I need to know the previous selected radio as well as the new one so I know whether to divide or multiply.
View 1 Replies
View Related
May 10, 2009
function read()
{
var numbers = new Array();
for (i = 0; i < field.length; i++)
numbers[i] = document.test.checkboxName.value;
var counter=0;
[Code]...
I want to read the values of the checkboxs and store the vlaues into an array (there are more than 1 checkboxs) the form name is text and the names of the check box = checkboxname
View 3 Replies
View Related
Jan 4, 2011
I have a bunch of checkboxes like below that the user can check some or all and click the button and see the values of all the selected checkboxes. How can I do that?
Code:
<script>
function alertValues(){
}
</script>
<input type="checkbox" class ="normal2" value="131971" name="list[]" >
[Code]...
View 1 Replies
View Related
Jul 23, 2006
Can someone suggest me a way to get the values of CheckBox(es) selected
in a CheckBoxList control using JAVASCRIPT.
I am pasting my current code gere but its not working need some
suggestions pls.
function CheckBoxList(cntrlName)
{
var cntrlValue = listValuesCheckBox(cntrlName);
return cntrlValue ;
}
function listValuesCheckBox(objectName)
{
var list = "";
for (var i=0; i<objectName.length;i++){
if (objectName.Options[i].selected = true){
list += objectName.Options[i].value+ '~'
}
}
return list;
}
View 6 Replies
View Related
Mar 13, 2010
I've a group of checkboxes and I want to insert the values in table field in 01010 format. So for example, if PHP & HTML checked then the value will go into table field would be 01010.
<form name="form1">
<input type="checkbox" name="check_list" value="1">ASP
<input type="checkbox" name="check_list" value="1">PHP
<input type="checkbox" name="check_list" value="1">C
<input type="checkbox" name="check_list" value="1">HTML
<input type="checkbox" name="check_list" value="1">MySQL
</form>
View 3 Replies
View Related
Nov 2, 2010
I am trying to do some JavaScript calculation with checkboxes, and have been able to modify some codes to do bits of what i want to do. (Screenshot attached) However, i want each checkbox to have multiple values, and therefore multiple results.
I can't find any examples, but i've come across something similar with Radio buttons [URL].. I don't 'get' the example enough to proceed. My question is, is it even possible to do with a checkbox, and if so how do i go about doing it please?
The Javascript code:
function count() {
var item1price = 10;
var item2price = 50;
var item3price = 1100;
var item4price = 100;
[Code]...
View 3 Replies
View Related
Nov 2, 2010
I am trying out checkbox total calculator code examples, which automatically calculates the values of checked/unchecked items, and so far so good. My question is if it's at all possible for each checkbox to have multiple values, so i can have different sets of totals? I have been looking for examples all over with no luck. I have seen examples for Radio buttons, which separates the different totals with commas, but i don't have enough JavaScript experience to understand it fully.
View 11 Replies
View Related
Jan 10, 2011
I have some checkboxes on a form like this: -
Code HTML4Strict:
<form id="EventForm" name="EventForm" method="post">
<input name="EventRecur[]" type="checkbox" class="checkbox" value="EveryDay" />
<input name="EventRecur[]" type="checkbox" class="checkbox" value="Monday" />
<input name="EventRecur[]" type="checkbox" class="checkbox" value="Tuesday" />
</form>
[Code]...
View 1 Replies
View Related
May 20, 2009
So, I am in a Web Development class right now for my liberal arts science credit. We are on a lab dealing with JavaScript and half of it is making the values of some check boxes and stuff show up when the user clicks a "Display" button. I'm not sure I'm explaining it well. Here's the lab:
# In lab 6 you wrote a JavaScript function that displayed the name and email entered from the form. Extend that function to display all of the information the user entered in the form (name, e-mail, region, special interests, interest level, and comments). See if you can nicely format what shows in the alert message. The following hints should help:
1. The first step is to make sure that each GUI field has an id attribute set. For example the name field might have id="name". Remember, every id value must be unique. Two radio buttons will have the same name attribute value, but their id attributes must be unique. You need to do this so JavaScript can find the tags using the document.getElementById method.
2. To display your checkbox information, you will need to include logic as described in the following steps. Once you do this, do the same thing for the radio buttons.
1. Assume you have a checkbox with id="cherokee". Of course, your id attributes will likely have different names. The general steps will be the same, but substitute your names where I'm using "cherokee".
2. The following statement creates a Boolean value (true, false) that determines if the user checked the cherokee checkbox. The checked property in checkbox and radio button objects gives this information.
[Code]...
View 3 Replies
View Related
Oct 30, 2009
I have four checkboxes and one textbox. If I checked 3 checkboxes the value 3 will be shown in textbox.
View 1 Replies
View Related
Dec 28, 2009
I have a page where a user can select (via check boxes) several categories. Each category is related to a set of possible options (radio buttons) that have numeric values. When one of the options (radio button) is selected, the amount will appear in a text box (input type="text"). The numeric value in the text box will update depending on what category options are selected. However, when the checkbox is deselected, the radio boxes in the <div> are not displayed and I need to remove (reset) the radio button values from the value seen in the text box.
<script type="text/javascript">
var amountNotice = 0;
function notice(options)[code]....
Everything works except for my uncheckRadio function - not sure if I am identifying the elements correctly, or if I need a totally new approach. My thinking is that the function must be accessed by the checkbox onClick call. Previously I had tried calling uncheckRadio from the notice function before I recognized is was not an appropriate location.
View 2 Replies
View Related
Apr 30, 2010
The problem I have is that the value="" needs to be the ID number of the recordset but still be able to SUM the dollar value on the TEXT box (totalcost) when someone click on each CHECKBOX. The CHECKBOX values will be coming out of a database using PHP. How do I modify the Javascript to accomplish what I'm looking for.
Code:
<script type="text/javascript">
function UpdateCost() {
var sum = 0;
var gn, elem;
for (i=0; i<5; i++) {
gn = 'game'+i;
elem = document.getElementById(gn);
if (elem.checked == true) { sum += Number(elem.value); }
}document.getElementById('totalcost').value = sum.toFixed(2);
}
</script>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
<input type="checkbox" id='game0' value="9.99" onclick="UpdateCost()">Game 1 ( 9.99)<br>
<input type="checkbox" id='game1' value="19.99" onclick="UpdateCost()">Game 2 (19.99)<br>
<input type="checkbox" id='game2' value="27.50" onclick="UpdateCost()">Game 3 (27.50)<br>
<input type="checkbox" id='game3' value="45.65" onclick="UpdateCost()">Game 4 (45.65)<br>
<input type="checkbox" id='game4' value="87.20" onclick="UpdateCost()">Game 5 (87.20)<br>
<input type="text" id="totalcost" value="">
</form>
View 14 Replies
View Related
Oct 19, 2009
I have the following code working with the checkbox options but once I added a drop down menu with values, it doesn't calculate it. I've done some different things to try to add the drop down to the function but nothing would work that I've tried so far.
I have it setup so when a box is unchecked, that option is taken off the price, the drop down should do the same to switch between the options price.
[Code]...
View 1 Replies
View Related
Feb 6, 2010
I have checkbox inputs like so:
<input type="submit" value="One" id="one" />
<input type="submit" value="Two" id="two" />
Say they are both checked.. How would I send those values through the code below properly?
$('#submit').click(function(){
value = $('input:checked'); // not sure how to collect all checkbox values here so they can be sent..
[code]....
View 5 Replies
View Related
Sep 11, 2009
A webpage has a number of questions that a user must answer and each question can be answered using a list of checkboxes. Thus each set of checkboxes (each question) will have a seperate name. The webpage is dynamically generated and I dont know how many questions will be on there nor the amount of checkboxes each question will have.
I know how to obtain the checkbox values using a form and a conventional submit button however what I want to do is put a button below each question and use AJAX to submit the answers for each question therefore the whole page will not refresh once each question is submitted.
I assume I will have to create a string that contains the values of the checkboxes joined together with delimiters because it is not possible to POST and actual array? So how do I obtain the values of the checkboxes for each individual question using JavaScript?
View 1 Replies
View Related
Jan 18, 2010
I have a pricing page that is broken into multiple categories per phase. I want a customer to be able to select my checkboxes and hit a button that will display a rolled up total. I also want it to be able to re-calculate the totals if a box is subsequently unchecked. I have browsed and searched the form to get the code to where it is now but need help to finish it.
View 10 Replies
View Related
Apr 13, 2009
My last topic should be deleted, because now I know what my REAL problem is.I have a form with a series of radio buttons and checkboxes, but when I submit the form blank, Javascript says they have a value!So if someone could help me figure out why that even though the radio buttons are blank, they seem to have a default value?If you really want, I can post the code, but be very warned, the code is huge.
View 1 Replies
View Related
Nov 26, 2009
How can I get the sum of cell values that is checked after submitting the form...here's the basic html that I have..
Code HTML4Strict:
<form>
<table>
[code].....
View 4 Replies
View Related
Nov 15, 2011
Here is the code I have written but it is only taking one value out of the several checkbox checked
View 3 Replies
View Related
Nov 25, 2011
how I can use Jquery to append and remove data into a table by checking and unchecking html checkboxes?(Or any plugin for this?) I would like to generate an online order invoice from the following checkboxes:
<
fieldset
>
<
[Code].....
I find these two example on the net but (The first example looks too similar to what I would like to do but with a table) but Icouldn'tfigure out how to modify them? [URL]
View 11 Replies
View Related
Apr 5, 2011
function sendValues() {
Upon reload, the values are serialized.. But when the page is done loading..the chosen values (checkbox) is not checked, I need it stay checked so I can add other values via checkbox to the url.
Here is a live demo.. [url]
View 1 Replies
View Related