Calculate totals in Web Form Builder? - Page 7


Registered User
60 posts

Thanks Eric,

Inserted it into my HTML file; doesn't seem to work.

Do I need COST1, COST2, COST3, COST4 & COST5 instead of just COST?

Or, did I not insert the jQ code correctly?
>don<


Senior Advisor
17,656 posts

Looks like you changed the name of your GrandTotal input to TOTAL. Give this a try.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
var jQ = $.noConflict(true);
// version 2
function calctotal(){
var total = 0;
jQ("input[name^='COST']").each(function(){
var value = jQ(this).val();
if(value >0 && jQ.isNumeric(value)){
total+=parseFloat(jQ(this).val(),10);
}
});
jQ("input[name=TOTAL]").val(total.toFixed(2))
}
jQ().ready(function(){
jQ("input[name^='COST']").change(function(){
calctotal()
});
});
</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
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 personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Registered User
60 posts

Thanks Eric,

Sorry about changing var name.
I know better, just had a temporary outbreak of the stupids.
>don<


Registered User
60 posts

Mornin' Eric,

Now realize I should've asked for the five COST items values be input by jG script.

If it isn't too much trouble your help will be appreciated.

>don<


Senior Advisor
17,656 posts

A few questions. Your using checkboxes. Is it possible that the user could check all 9 options?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
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 personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Registered User
60 posts

Yes. But, highly unlikely.
>don<


Senior Advisor
17,656 posts

Is each line meant to set the requirements of one user? If so then you would be better off using radio buttons. It makes a huge difference in the coding structure.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
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 personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Registered User
60 posts

Had considered that to begin with and decided needed checkboxes.
Will look at it again.
>don<


Registered User
60 posts

Eric,

How can I have Radio Button Element that allows none to be selected?
>don<


Registered User
60 posts

Did that but, when open the form cannot have a group without one item being selected. Just like a typical radio button group.
>don<

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.