Hello Everyone 😊
I’m creating a Estimate Form like below and i wonder know if you know how to make Last Field (…SUM…) to display the Total SUM of all Prices ?
The idea i want looks like this : http://www.hippodrom.de/fruehlingsfest/#reservieren (at below of this page you can see the dynamic SUM displays the total of prices selected and chosen).
My example Estimate Form below :
My template code content :
{exp:channel:entries channel="list_product" limit="1" author_id="CURRENT_USER"}
<div left; width: 260px;">
<form action="action_page.php">
Select Product 1 : {product_1_100} or {product_1_150}
Select Product 2 : {product_2_200} or {product_2_250}
Select Product 3 : {product_3_300} or {product_3_350}
Total Price : ...SUM...
<input type="submit" value="Submit">
</form>
</div>
{/exp:channel:entries}
My template looks :
Select Product 1 : [ ] 100€ or [ ] 150€ >>> I chose here : 100€
Select Product 2 : [ ] 200€ or [ ] 250€ >>> I chose here : 200€
Select Product 3 : [ ] 300€ or [ ] 350€ >>> I chose here : 300€
Total Price : ...SUM... >>> It has to change automaticly to 600€
Submit Button
PS : When i click the “Submit” button, the form-data will be sent to a page called “action_page.php” or to “EE Edit Channel Entries” where i can see the Estimate data stored.
So now, i’m still looking the Script or Code in order to display the …SUM… automaticly on the online template to 600€ ?
Please let me know if you know some Addons like this at Devot-ee or perhaps a Developper who can make it ?
Regards.
Something like this? Requires jQuery…
note: “Removed” in the code means open and closed script tag… And behind the class=”price” are “onchange=”sum(‘price’);”” removed
[removed]
function sum(price) {
$("."+price+"sum").val(0);
var sum = 0;
$("."+price).each(function() {
if(!isNaN(this.value) && this.value.length!=0) {
sum += parseFloat(this.value);
}
});
$("."+price+"sum").val(sum);
update(id);
}
[removed]
<form method="post" action="#">
Apples: <select name="Apples" class="price" >
<option>Your Choice</option>
<option>100</option>
<option>200</option>
</select>
Apples: <select name="Apples1" class="price" >
<option>Your Choice</option>
<option>100</option>
<option>200</option>
</select>
Apples: <select name="Apples2" class="price" >
<option>Your Choice</option>
<option>100</option>
<option>200</option>
</select>
Summary: <input type="text" class="pricesum" />
</form>
Hi Ingo,
Yes the JQuery will be good too, wow that’s i’m looking for :D Is it your mail Ingo : [email protected] ?
I’m in a project now, and next week if my project is confirmed, i’ll contact you for asking more like this and i hope you have Paypal 😊
Thank you for that JQuery !
Regards.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.