Adding 3% to form total

User 2623310 Photo


Ambassador
282 posts

Hi All,
I'm in the process of making payment a payment form. I field with two radio buttons that are PayPal or invoice sent to you. The next field below is radio buttons with 7 different amounts of money that shows only if the PayPal button is check. I added a number field below it and its only shows if the PayPal button is check. For the number field Form Total multiplier for payments. My questions is what else I need to do to get the 3% added to total amount money which ever is check?

Thanks for the help
User 187934 Photo


Senior Advisor
20,271 posts

This should help. Take a look. You'll need to alter it to look for your checkbox value. Can you share a link?
http://ericrohloff.com/coffeecup/ccforu … uspercent/
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 2623310 Photo


Ambassador
282 posts

Her you go. Here's a link to the form.

http://auctionbrick.com/sandbox/payment … ntfee.html
User 2623310 Photo


Ambassador
282 posts

Hi Eric,

Do I need to get rid of this one var valtwo = .20; and changed this one var valthree = 1.014; to var valthree = 1.03;?

Thanks
User 187934 Photo


Senior Advisor
20,271 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 5
jQ( document ).ready(function() {
jQ('input[name="totalamount"]').val((441 * 1.03).toFixed(2));
jQ('input[name="typeofpayment"]').on('click', function() {

var value = jQ(this).val();
if(value =="Logo Design (75.00)"){

var plus3percent = 75 * 1.03;
}else if(value =="Stater Pkg (189.00)"){

var plus3percent = 189 * 1.03;
}else if(value =="Basic Pkg (357.00)"){

var plus3percent = 357 * 1.03;
}else if(value =="Business Pkg (441.00)"){

var plus3percent = 441 * 1.03;
}else if(value =="Total Pro Pkg (504.00)"){

var plus3percent = 504 * 1.03;
}else if(value =="Basic Hosting Pkg (48.00)"){

var plus3percent = 48 * 1.03;
}else if(value =="Premiun Hosting Pkg (72.00)"){

var plus3percent = 72 * 1.03;
}

if(plus3percent > 0){
jQ('input[name="totalamount"]').val((plus3percent).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 2623310 Photo


Ambassador
282 posts

Eric,
I try the code and it does add the 3% to the total but for one thing, it gives me this error( Please enter a valid number.) when I try to submit the form.

Thanks
User 187934 Photo


Senior Advisor
20,271 posts

In the form builder you need to change the number properties for the total input to be Decimals: 2.
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 2623310 Photo


Ambassador
282 posts

Eric,

I must have something set up something one. I have change the decimals to 2 but when I test the form the total price went 26,000 +. What do I need to change?

Thanks
User 187934 Photo


Senior Advisor
20,271 posts

I tweaked the code above. Give it another try.
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 2623310 Photo


Ambassador
282 posts

Hi Eric,

Getting closer. When I click on the PayPal button to go pay it pops up with this error

Error Detected
Error Message

You have entered an invalid quantity value. A quantity value must be an integer greater than or equal to one.

Thanks for the help!

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.