Show a total $ Amount - Post ID 270562

User 187934 Photo


Senior Advisor
20,188 posts

I've done name for a few projects but always find myself needing to target ID or classes so I tend to stick with those. I'm glad you dug a little and learned a little JQuery.:cool:
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 506998 Photo


Registered User
164 posts



Hey Eric... I got your script to work, the total is the correct addition of the other payment fields and the correct amount is sent to Paypal... but only if I retype the total amount back into that field. The total field gives me an error saying I have to enter a valid number. If I retype the sum total amount shown back into that field, it works. It's like it's not being activated. Or maybe I can make it read only? Can I do this with some inline code rather than having to use jscript ? Thanks.
Just tried using readonly="readonly" and it becomes readonly but still has the problem... and then I can't retype the value.
:o
User 506998 Photo


Registered User
164 posts

OK... I got it work by removing all the min and max value constraints and making the type blank:
<input name="payment_total" id="item67_number_1" type="" readonly="readonly" />

....where "item67_number_1" is the div id of the total.
And the readonly keeps any strange data from being entered.
User 187934 Photo


Senior Advisor
20,188 posts

Awesome!:cool:
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 506998 Photo


Registered User
164 posts

Eric- I know those are old instructions..
http://ericrohloff.com/coffeecup/ccforum/formbuilder/payment_forms/runningtotal/
But the two things I would add are:
For the payment total div on the html, I'd manually add
readonly="readonly"
and
in form builder I'd tell folks to make sure they had 2 decimal points under properties for the total field.
This seems to be what was hanging my form. Because for the total form field under properties I was using "none" for payments, it did not auto select 2 decimal points. (and I don't use pennies in pricing :P )
Here's the form (hidden from public while in beta)
http://balletchildren.com/reg_test/test.php
Been using Form Builder for their registration for years and keep tweaking it. Notice the admin/verify radio button.
The form generates an additional spreadsheet column that is used to indicate payment processed, so using a radio button with only one selection already selected does this. I'm sure there are more elegant & hidden ways to accomplish this...:D
User 506998 Photo


Registered User
164 posts

I also got rid of the up down increment arrows using this in the head of the html form created by Form Builder:

<style type="text/css">
input[type=number].input-number–noSpinners { -moz-appearance: textfield; }
input[type=number].input-number–noSpinners::-webkit-inner-spin-button,
input[type=number].input-number–noSpinners::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style>

And adding the "input-number–noSpinners" classname to any inputs I wanted to effect.

My full div code for the total field is now:

<div class="fb-input-number"> <!-- the div holding my total box in Form Builder -->
<input name="payment_total" id="item67_number_1" class="input-number–noSpinners" type="number" min="0"
max="9999" data-hint="" autocomplete="off" readonly="readonly" />
</div>
User 187934 Photo


Senior Advisor
20,188 posts

I use a regular expression for most of my inputs now to dump those spinners. I don't always recommend manually altering the forms as your relying on Jquery anyways so if people have it disabled then it won't matter. I don't recommend what the inputs should have as far as how many decimals as I do these on a request and look at what the users has and set the js to fit the need. I'm glad your messing around with the code. That will teach you how to customize it to fit your needs.:cool:
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 506998 Photo


Registered User
164 posts

Eric Rohloff wrote:
I don't recommend what the inputs should have as far as how many decimals as I do these on a request and look at what the users has and set the js to fit the need.

OK... but if they are using your easy code example above for adding monetary payments, then they MUST set the Sum Total properties in FB to 2 decimal places, because if you set the Payments attribute to none in the form for the Sum Total, and set decimals to none, you will get an error. For the amounts that are being added, setting Payments to Price Input automatically adds the 2 decimals to those fields and that cannot be disabled. I'm just saying if anyone stumbles upon this code option and wants to use it, that what ya got to do...
I'll look into the expression that dumps the spinners.... Thanks !
User 187934 Photo


Senior Advisor
20,188 posts

sum.toFixed(0) is another option ;)
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.