Calculate totals in Web Form Builder?...

User 49135 Photo


Registered User
14 posts

hourstotalwk1mon
hourstotalwk1tues
hourstotalwk1wed
hourstotalwk1thurs
hourstotalwk1fri
hourstotalwk1sat

hourstotalwk2mon
hourstotalwk2tues
hourstotalwk2wed
hourstotalwk2thurs
hourstotalwk2fri
hourstotalwk2sat
Work Hard | Play Hard
User 187934 Photo


Senior Advisor
20,239 posts

Ok, You'll need to give me a bit as I have Jury Duty for a few days.;)
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 49135 Photo


Registered User
14 posts

Good Luck with Jury Duty! And, THANK YOU!
Work Hard | Play Hard
User 187934 Photo


Senior Advisor
20,239 posts

See if this is what you need.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
var jQ = $.noConflict(true);
// version 1
jQ( document ).ready(function() {
// Set totalhours to read only
jQ('input[name="TotalHours"]').prop('readonly', true);
// add the class sum to all inputs that we want to add
jQ('input[name^="hourstotalwk"]').addClass( "sum" );
// on keyup check that the value isn't blank and it's numeric
jQ('input[name^="hourstotalwk"]').on('keyup', function() {

if (jQ(this).val()!="" || jQ.isNumeric(jQ(this).val())){
// if input value is good fire the function
calc_dues();
}
});

// This is the calculate function
function calc_dues() {

var sum = 0;

jQ('.sum').each(function(){

if(jQ.isNumeric(this.value)){

sum += parseFloat(this.value);

jQ('input[name="TotalHours"]').val(sum);

}
});
}
});
</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 49135 Photo


Registered User
14 posts

ERIC!!!!!!

IT WORKS!!!!!!!!!!!!!!!!!!!!!!!!

:D:D:D:D:D:lol::lol::lol:

THANK YOU!!!!

(Can I pay you a little?)
Work Hard | Play Hard
User 1982097 Photo


Registered User
72 posts

Hi,
I also have a pretty simple form about 20 numeric fields. I need to simply present a running total of the numbers entered in a total field.
Question - If i invest the time to apply a javascript to the form to make this work, will I be able to re-open the finished form in WFB to change form settings ie. table name, email confirm etc?

Or will WFB not open the form up?

I currently create a form from a template for each customer and have it save data to a different table name for each.
Coffee roasting is my passion - seriously
User 187934 Photo


Senior Advisor
20,239 posts

Most of these adjustments are done within the form builder using a html element.
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 1982097 Photo


Registered User
72 posts

OK. Thanks. I'm not a programmer but I might be able to fudge my way through adapting your JS to my form. I'll try anyway. When enterng the JS as an html element, do i need to select a "property type"? sorry if it's a stupid question.
Coffee roasting is my passion - seriously
User 187934 Photo


Senior Advisor
20,239 posts

If you share your form I can help you along. I'm not sure what your meaning by "Property type"
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 1982097 Photo


Registered User
72 posts

http://givingbean.coffeecup.com/forms/eztest/
Here is the form. Trying to add all item fields and provide a running total inform.
Thanks
Don't really even know where to start with jquery - nover done before
Coffee roasting is my passion - seriously

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.