473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Get form input total

I am totally duh at javascript although I have 2 books trying to learn it.

I am trying to add values to a form and have a calculate total at end.
this is my form script. I have hours at end of each radio or checkmark. (If this is checked, add these hours. ) I want to calculate total at the calculate button at the bottom of the form and have a window that shows the total.

please excuse the long form, but with all the different variables I thought it wise to post whole thing.

[HTML]<form method="post" action="">
<fieldset name="General">
<legend class="alignleft">General</legend>
<p>
<input name="Have_Site" type="radio" checked="checked" />&nbsp;&nbsp;
I have an existing website.&nbsp; (0 hours)</p>
<p><input name="Have_Site" type="radio" />&nbsp;&nbsp;
I need a basic blog site.&nbsp; (3 hours)</p>
<p>
<input name="Have_Site" type="radio" />&nbsp;
I need a basic, off the shelf, template based site
set-up.&nbsp; (6 hours)</p>
<p><input name="Have_Site" type="radio" />&nbsp; I need a completely custom site.&nbsp; (15 hours)<br />
</p>
</fieldset>
<fieldset name="Site Layout">
<legend class="alignleft">Site Layout</legend>
<p>
<input name="No_Graphics" type="radio" checked="checked" />&nbsp;
I do not need any unique graphics designed.&nbsp;&nbsp;
(0 hours)</p>
<p><input name="Have_Graphics" type="radio" />&nbsp; I have all
my graphics but they need to be integrated. (3 hours)</p>
<p><input name="Template_Minor" type="radio" />&nbsp; I have a
template but it needs minor customization.&nbsp; (6
hours)</p>
<p><input name="Template_Major" type="radio" />&nbsp; I have a
template but it needs major custimzation.&nbsp; (10
hours)</p>
<p><input name="Custom_Design" type="radio" />&nbsp; I would
like a custom design created for my site.&nbsp; (20
hours)&nbsp;</p>
</fieldset>
<fieldset name="Other Graphics">
<legend class="alignleft">Other Graphics</legend>
<p><input name="Need_Custom_Graphics" type="checkbox" />&nbsp; I
need some custom graphics made.&nbsp; (4 hours)</p>
<p><input name="Mouse-over_Graphics" type="checkbox" />&nbsp; I
need graphic mouse-over buttons.&nbsp; (4 hours)</p>
<p><input name="Few_Stock" type="checkbox" />&nbsp;&nbsp; I
need a few stock photographs integrated.&nbsp; (4 hours)</p>
<p><input name="More_Stock" type="checkbox" />&nbsp;&nbsp; I
need several stock photographs integrated.&nbsp; (9
hours)</p>
</fieldset>
<fieldset name="Flash">
<legend class="alignleft">Flash</legend>
<p><input name="Flash_Menu" type="checkbox" />&nbsp; I
need a flash menu.&nbsp; (6 hours)</p>
<p><input name="Flash_Animation" type="checkbox" />&nbsp;&nbsp; I
need a short custom flash animation.&nbsp; (3 hours)</p>
<p><input name="Total_Flash" type="checkbox" />&nbsp;&nbsp; I
want my site in Flash for a total of&nbsp;
<select name="Select1">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
</select>&nbsp; pages.&nbsp; (5 hours per page.)</p>
<p><input name="Flash_Banner" type="checkbox" />&nbsp;&nbsp; I
need a flash banner.&nbsp; (4 hours)</p>
</fieldset>
<fieldset name="Content">
<legend class="alignleft">Content</legend>
<p>
<input name="I_add_Content" type="radio" checked="checked" />&nbsp;
I will add my content with a content manager.&nbsp; (0
hours)</p>
<p><input name="Content_Pages" type="radio" />&nbsp;&nbsp; I will
supply <select name="Select2">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select> pages of content in MS Word or Notepad text.&nbsp;
(3 hours per page)</p>
<p><input name="Copyrighting_Pages" type="checkbox" />&nbsp; I need
<select name="Select3">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select> pages of copywriting done for my content.&nbsp;
(5 hours per page.<br /></p>
</fieldset>
<fieldset name="Public Features">
<legend class="alignleft">Public Features</legend>
<p><input name="Member_Registration" type="checkbox" />&nbsp;
Member Registration&nbsp; (6 hours)</p>
<p><input name="Discussion_Forum" type="checkbox" />&nbsp;&nbsp;
Discussion Forum&nbsp; (5 hours)</p>
<p><input name="Contact_Form" type="checkbox" />&nbsp;
Contact Form&nbsp; ( 3 hours)</p>
<p><input name="Links_Page" type="checkbox" />&nbsp;
Links Page&nbsp; (3 hours)</p>
<p><input name="Site_Search" type="checkbox" />&nbsp;
Site Search&nbsp; (4 hours)</p>
<p><input name="Auto-Responder" type="checkbox" />&nbsp;
Email Auto-responder (2 hours)</p>
<p><input name="File_Upload" type="checkbox" />&nbsp;
File upload ( 8 hours)</p>
</fieldset>
<fieldset name="Ecommerce">
<legend class="alignleft">Ecommerce</legend>
<p><input name="Simple_Cart" type="checkbox" />&nbsp;
Simple shopping cart&nbsp; (5 hours)</p>
<p><input name="Database_Cart" type="checkbox" />&nbsp;
Database shopping cart&nbsp; (10 hours)</p>
<p><input name="Credit_Card" type="checkbox" />&nbsp;
Credit Card Processing&nbsp; ( 4 hours)</p>
<p><input name="PayPal" type="checkbox" />&nbsp;
PayPal&nbsp; processing</p>
</fieldset>
<fieldset name="Admin_Features">
<legend class="alignleft">Admin Features</legend>
<p><input name="Blog" type="checkbox" />&nbsp; Off
the shelf Blog&nbsp; (3 hours)</p>
<p><input name="Custom_Blog" type="checkbox" />&nbsp;
Custom Site Blog&nbsp; (6 hours)</p>
<p><input name="Photo_Gallery" type="checkbox" />&nbsp;
Photo Gallery&nbsp; (6 hours)</p>
<p><input name="Member_Admin" type="checkbox" />&nbsp;
Member Administration&nbsp; (5 hours)</p>
<p><input name="Site_Statistics" type="checkbox" />&nbsp;
Site Statistics (1 hour)</p>
</fieldset>
<fieldset name="SEO">
<legend class="alignleft">SEO</legend>
<p><input name="MetaTag" type="checkbox" />&nbsp;
MetaTag Keyword Optimization (5 hours)</p>
<p><input name="Search_Engine_Submission" type="checkbox" />&nbsp;
Search Engine Submission (3 hours)</p>
<p><input name="Link_Building" type="checkbox" />&nbsp;
Minor Link Building (6 hours)</p>
</fieldset>

<br />
<input name="Calculate_Cost" type="button" value="Calculate Cost" /></form>[/HTML]
Aug 18 '08 #1
1 1798
acoder
16,027 Expert Mod 8TB
Have you managed anything so far?

What I suggest you do is name the radio buttons with the same name for each section. That way you can access all of them in one go and then loop over them. Alternatively, use document.getElementsByTagName("input") to get all of the input elements on the page. Also add value attributes for each radio button that contains the hours figure. That would make it easier to add up the values.
Aug 19 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: elji | last post by:
In my form, I have 4 objects that I want to work together: <input name="price" type="text" id="price" value="100" size="4"> <input name="quantity" type="text" id="quantity" value="1"...
2
by: Fred | last post by:
Hi, I defined a form consisting of checkboxes like: <form> <input type="checkbox" name=ck id=ck onclick="check(this.form)" <input type="checkbox" name=ck id=ck onclick="check(this.form)" ........
10
by: giancarlodirisioster | last post by:
Can someone help me modify this for future Usenet archival and to help me solve what I don't know? <form name="addform" method="POST" action="./submit.php"> <input type="text" name="Box 1"...
4
by: Rich_C | last post by:
I'm sure this is very simple, but I have very little experience with javascript -- and what I do know isn't helping me here. I have a simple form where users can enter a quantity (qty) and cost...
5
by: timothy.pollard | last post by:
Hi I'm having a bit of bother trying to make a questionnaire do what I want it to. I have put it up on www.web-iq.co.uk/test.htm. Basically the user of the final form (when I've tarted it up)...
4
by: timothy.pollard | last post by:
Hi all A few weeks ago a nice man called Evertjan helped me create a form validation system that took a table of four columns of checkboxes and: - allowed only one checkbox in each row to be...
4
by: David | last post by:
Hi, I have a MAINFORM with a pop-up form link and a textfield The POPUPFORM displays 3 columns (1) Description : (2) £Charge : (3) Checkbox Each charge will be different for the various...
2
by: sammiesue | last post by:
Hi, I have form with 2 autosummed textboxes ("total" and "casinototal"). I would like to have a grand total textbox ("grandtotal") get its value from summing "total" and "casinototal", but it...
13
by: DDragon | last post by:
ok here is the problem, i have to forms which have values i wish to be added together i can add together the values in one form all right but im having problems with adding the values of the other...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.