Including the forms "Order Total" on...

User 2885601 Photo


Registered User
42 posts

I've created a form for purchasing raffle tickets for a charitable organizations. When the user hit's submit it displays an order itemization / order total display that looks like this:

https://mfa-sibs.org/files/Capture33.png

When the user clicks on the email button icon it brings up an order confirmation page - shown below. How can I insert the Order Total Due amount on the confirmation page in the place I've outlined in red:

https://mfa-sibs.org/files/Capture34.jpg
User 187934 Photo


Senior Advisor
20,188 posts

Hi James,
I've help several users with this. You'll need a jquery script to insert the total of your items into an input so it get submitted and can be displayed to the user in the confirmation.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2885601 Photo


Registered User
42 posts

Thanks for your reply Eric. I'm afraid that a jQuery script is beyond my capabilities. Can you help me with this. You can find my form here: http://mfabenefit.org/raffledonations/ and I am attaching my form builder file.
Attachments:
User 187934 Photo


Senior Advisor
20,188 posts

Give this a try.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
var jQ = $.noConflict(true);
// version 1
var CashRaffleSingleTicket = 5;
var CashRaffleBundle = 25;
var CarRaffleSingleTicket = 50;
var CarRaffleBundle = 100;
var CelebrateMisTeckets = 100;

jQ( document ).ready(function() {
// Set TotalOrder to read only
jQ('input[name="OrderTotal"]').prop('readonly', true);

jQ('select[name="CashRaffleSingleTicket"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CashRaffleSingleTicket"]').data('price',CashRaffleSingleTicket);

}else{jQ('select[name="CashRaffleSingleTicket"]').data('price','');};
calc_dues();
});

jQ('select[name="CashRaffleBundle"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CashRaffleBundle"]').data('price',CashRaffleBundle);

}else{jQ('select[name="CashRaffleBundle"]').data('price','');};
calc_dues();
});

jQ('select[name="CarRaffleSingleTicket"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CarRaffleSingleTicket"]').data('price',CarRaffleSingleTicket);

}else{jQ('select[name="CarRaffleSingleTicket"]').data('price','');};
calc_dues();
});

jQ('select[name="CarRaffleBundle"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CarRaffleBundle"]').data('price',CarRaffleBundle);

}else{jQ('select[name="CarRaffleBundle"]').data('price','');};
calc_dues();
});

jQ('select[name="CelebrateMisTeckets"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CelebrateMisTeckets"]').data('price',CelebrateMisTeckets);

}else{jQ('select[name="CelebrateMisTeckets"]').data('price','');};
calc_dues();
});

// This is the calculate function
function calc_dues() {
jQ('input[name="OrderTotal"]').val(sum_price);
var sum_price = 0;

jQ('select[name^="C"]').each(function(){

if(this.value!= 0 && jQ(this).data('price')!=''){

sum_price += parseFloat(this.value) * parseFloat(jQ(this).data('price'));
jQ('input[name="OrderTotal"]').val(sum_price);

}
});

}
});
</script>

Working here.
https://ericrohloff.com/coffeecup/ccfor … s_capraro/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2885601 Photo


Registered User
42 posts

Eric Rohloff,
You are the Master - this works perfectly. You can see the new form here: http://mfabenefit.org/raffledonations/.

Would you please permit me to make one last request. Is there a way to adjust the code to have the calculated OrderTotal input appear in American currency format -- $00.00?
User 187934 Photo


Senior Advisor
20,188 posts

Yup,
You'll need to change your total input to a text input.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
var jQ = $.noConflict(true);
// version 2
var CashRaffleSingleTicket = 5;
var CashRaffleBundle = 25;
var CarRaffleSingleTicket = 50;
var CarRaffleBundle = 100;
var CelebrateMisTeckets = 100;

jQ( document ).ready(function() {
// Set TotalPrice to read only
jQ('input[name="OrderTotal"]').prop('readonly', true);

jQ('select[name="CashRaffleSingleTicket"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CashRaffleSingleTicket"]').data('price',CashRaffleSingleTicket);

}else{jQ('select[name="CashRaffleSingleTicket"]').data('price','');};
calc_dues();
});

jQ('select[name="CashRaffleBundle"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CashRaffleBundle"]').data('price',CashRaffleBundle);

}else{jQ('select[name="CashRaffleBundle"]').data('price','');};
calc_dues();
});

jQ('select[name="CarRaffleSingleTicket"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CarRaffleSingleTicket"]').data('price',CarRaffleSingleTicket);

}else{jQ('select[name="CarRaffleSingleTicket"]').data('price','');};
calc_dues();
});

jQ('select[name="CarRaffleBundle"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CarRaffleBundle"]').data('price',CarRaffleBundle);

}else{jQ('select[name="CarRaffleBundle"]').data('price','');};
calc_dues();
});

jQ('select[name="CelebrateMisTeckets"]').on('change', function() {
if (jQ(this).val()!=0){
jQ('select[name="CelebrateMisTeckets"]').data('price',CelebrateMisTeckets);

}else{jQ('select[name="CelebrateMisTeckets"]').data('price','');};
calc_dues();
});

// This is the calculate function
function calc_dues() {
jQ('input[name="OrderTotal"]').val(sum_price);
var sum_price = 0;

jQ('select[name^="C"]').each(function(){

if(this.value!= 0 && jQ(this).data('price')!=''){

sum_price += parseFloat(this.value) * parseFloat(jQ(this).data('price'));
jQ('input[name="OrderTotal"]').val("$"+sum_price.toFixed(2));
}
});

}
});
</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2885601 Photo


Registered User
42 posts

Wonderful! Thanks so much Eric. You can see that this form is helping to raise money for a Misericordia Home, a non-profit campus that provides a home to over 600 disabled adults and children. My daughter lives there. Your volunteer coding will help to greatly enrich the lives of those who live there.

Thank you so very much.
Jim Capraro

Again link to form is here:http://mfabenefit.org/raffledonations/
User 187934 Photo


Senior Advisor
20,188 posts

Your very welcome.:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.