PDA

View Full Version : Radiobuttons with values and how to calculate.



EffeX
04 Mar 2010, 10:08 AM
Hello,

Im am pretty new to the website building and especially with JavaScripting, so be please be gentle ;).
At the moment, i am working with Dreamweaver CS4.

I am creating a formula about the 'ecological footprint' with several Radiobutton questions.
These questions need to have a certain value attached to each possible answer and then when i press 'submit' at the end these values have to be added up and display the score. But how to?
Example:

Question 1
How do you go to work:

* Walking/Bycicle value: 0
* Train/bus value: 5
* Car value: 7

Question 2
How much do you travel by train/bus.

* Never value: 0
* Few times a month value: 2
* Few times a week value: 5
* Daily value: 10

*Submit* = Calculate and display values. For instance, Question 1 i had value 5 and question 2 value 10. So pressing submit should then dispay '15'.

This is what i have so far, the questions and answers are in dutch.


Hoe ga jij naar school?</strong></p>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<input name="question1" type="radio" id="question1_0" value="0" />
Lopend/Met de fiets</label>
<br />
<label>
<input type="radio" name="question1" value="5" id="question1_1" />
Met het openbaar vervoer</label>
<br />
<label>
<input type="radio" name="question1" value="10" id="question1_2" />
Met de auto</label>
<br />
</p>
</form>
<p><strong>Hoe vaak reis je met het openbaar vervoer?</strong></p>
<form id="form2" name="form2" method="post" action="">
<p>
<label>
<input type="radio" name="question2" value="0" id="question2_0" />
Nooit</label>
<br />
<label>
<input type="radio" name="question2" value="2" id="question2_1" />
Slechts een paar keer per maan</label>
<br />
<label>
<input type="radio" name="question2" value="5" id="question2_2" />
Wekelijks</label>
<br />
<label>
<input type="radio" name="question2" value="10" id="question2_3" />
Dagelijks</label>
<br />
</p>
</form>
<form id="form3" name="form3" method="post" action="">
<label>
<input type="submit" name="Bekijk de uit****!" id="Bekijk de uit****!" value="Bekijk de uit****!" />
</label>


PS: I have a addon for Dreamweaver called ' Form calculator' created by KaosWeaver but i don't really know how it works...

is_numeric
15 Mar 2010, 08:19 AM
I have a addon for Dreamweaver called ' Form calculator' created by KaosWeaver but i don't really know how it works...

If you acquiring addons then you will have to take time to research how they work.

A quick glance at the info you provided and I found this tutorial..

http://www.kaosweaver.com/ExtensionsHelp/kaoshelp.php?id=28

And this support forum

http://www.kaosweaver.com/bbs/