Calculate totals in Web Form Builder?...

User 2076706 Photo


Registered User
72 posts

If only one button in the element, after clicking it it cannot be turned off.
>don<
User 187934 Photo


Senior Advisor
20,238 posts

That's not possible. Leave it be and give me a while to look at it.
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 2076706 Photo


Registered User
72 posts

It's not finished.

Only done one of the five registrants sections. You can check it
>don<
User 187934 Photo


Senior Advisor
20,238 posts

Put your form back to checkboxes please.
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 2076706 Photo


Registered User
72 posts

Done.
>don<
User 187934 Photo


Senior Advisor
20,238 posts

Ok Thanks,
I'll see what I can come up with.;)
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 2076706 Photo


Registered User
72 posts

Thank you. I know it will be good.
>don<
User 187934 Photo


Senior Advisor
20,238 posts

How does this look?
http://ericrohloff.com/coffeecup/don/fill-cost.html
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 2076706 Photo


Registered User
72 posts

Hi Eric,

Everything I checked worked correctly.

Is "after Feb 5" also in the formulae?
>don<
User 187934 Photo


Senior Advisor
20,238 posts

Yes, I have a check for the date built in.
The only thing you'll need to do is make sure all your checkboxes are setup with the name starting with FUNCTIONS. You had a few that said Functions.
You also had a few checkboxes that had CLD LUN where it should be CHLD LUN.
My code depends on this.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
//ver 2.0
var jQ = $.noConflict(true);
jQ(document).ready(function(){
jQ("input[name^='COST']").attr('readonly', true);
jQ("input[name='TOTAL']").attr('readonly', true);
// Create expired date
var expiredDate = new Date("02/06/2018");
// Get today's date
var todaysDate = new Date();

jQ("input[name^='FUNC']").change(function() {
jQ("input[name^='COST']").val("");
var COST1 = 0;
var COST2 = 0;
var COST3 = 0;
var COST4 = 0;
var COST5 = 0;
jQ.each(jQ("input[name^='FUNC']:checked"), function(){
var name = jQ("input[name^='FUNC']:checked").attr("name");
var numbers = this.name.match(/\d+/);

// call setHours to take the time out of the comparison
if(expiredDate.setHours(0,0,0,0) > todaysDate.setHours(0,0,0,0)) {

//*** set the cost if before expired date for first FUNC ***//
if(jQ(this).is(':checked') && jQ(this).val() == "ADLT MBR REG"){
eval('var ADLT_MBR_REG' + numbers + '=40');}else {eval('var ADLT_MBR_REG' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "COL MBR REG"){
eval('var COL_MBR_REG' + numbers + '=15');}else {eval('var COL_MBR_REG' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "JOI MBR REG"){
eval('var JOI_MBR_REG' + numbers + '=10');}else { eval('var JOI_MBR_REG' + numbers + '=0');}

//*** set the cost if before expired date for second FUNC ***//
if(jQ(this).is(':checked') && jQ(this).val() == "ADLT LCH"){
eval('var ADLT_LCH' + numbers + '=25');}else {eval('var ADLT_LCH' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "CHLD LCH"){
eval('var CHLD_LCH' + numbers + '=10');}else {eval('var CHLD_LCH' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "ADLT DIN"){
eval('var ADLT_DIN' + numbers + '=40');}else { eval('var ADLT_DIN' + numbers + '=0');}

//*** set the cost if before expired date for third FUNC ***//
if(jQ(this).is(':checked') && jQ(this).val() == "CHLD DIN"){
eval('var CHLD_DIN' + numbers + '=10');}else {eval('var CHLD_DIN' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "ADLT BFT"){
eval('var ADLT_BFT' + numbers + '=15');}else {eval('var ADLT_BFT' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "FST TMR"){
eval('var FST_TMR' + numbers + '=0');}else { eval('var FST_TMR' + numbers + '=0');}

}else{
//*** set the cost if after expired date for first FUNC ***//
if(jQ(this).is(':checked') && jQ(this).val() == "ADLT MBR REG"){
eval('var ADLT_MBR_REG' + numbers + '=45');}else {eval('var ADLT_MBR_REG' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "COL MBR REG"){
eval('var COL_MBR_REG' + numbers + '=20');}else {eval('var COL_MBR_REG' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "JOI MBR REG"){
eval('var JOI_MBR_REG' + numbers + '=15');}else { eval('var JOI_MBR_REG' + numbers + '=0');}

//*** set the cost if after expired date for second FUNC ***//
if(jQ(this).is(':checked') && jQ(this).val() == "ADLT LCH"){
eval('var ADLT_LCH' + numbers + '=30');}else {eval('var ADLT_LCH' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "CHLD LCH"){
eval('var CHLD_LCH' + numbers + '=10');}else {eval('var CHLD_LCH' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "ADLT DIN"){
eval('var ADLT_DIN' + numbers + '=35');}else { eval('var ADLT_DIN' + numbers + '=0');}

//*** set the cost if after expired date for third FUNC ***//
if(jQ(this).is(':checked') && jQ(this).val() == "CHLD DIN"){
eval('var CHLD_DIN' + numbers + '=10');}else {eval('var CHLD_DIN' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "ADLT BFT"){
eval('var ADLT_BFT' + numbers + '=20');}else {eval('var ADLT_BFT' + numbers + '=0');}

if(jQ(this).is(':checked') && jQ(this).val() == "FST TMR"){
eval('var FST_TMR' + numbers + '=0');}else { eval('var FST_TMR' + numbers + '=0');}

}

eval('var ADLT_MBR_REG_NUM = ADLT_MBR_REG' + numbers);
eval('var COL_MBR_REG_NUM = COL_MBR_REG' + numbers);
eval('var JOI_MBR_REG_NUM = JOI_MBR_REG' + numbers);
eval('var ADLT_LCH_NUM = ADLT_LCH' + numbers);
eval('var CHLD_LCH_NUM = CHLD_LCH' + numbers);
eval('var ADLT_DIN_NUM = ADLT_DIN' + numbers);
eval('var CHLD_DIN_NUM = CHLD_DIN' + numbers);
eval('var ADLT_BFT_NUM = ADLT_BFT' + numbers);
eval('var FST_TMR_NUM = FST_TMR' + numbers);

//*** This passes the variable into the next cost input and sums the variables ***//
if(numbers == 11 || numbers == 12 ||numbers == 13){

COST1 += Number(ADLT_MBR_REG_NUM)+Number(COL_MBR_REG_NUM)+Number(JOI_MBR_REG_NUM)+Number(ADLT_LCH_NUM)+Number(CHLD_LCH_NUM)+Number(ADLT_DIN_NUM)+Number(CHLD_DIN_NUM)+Number(ADLT_BFT_NUM)+Number(FST_TMR_NUM) ;

jQ("input[name='COST1']").val(parseFloat(COST1).toFixed(2));

}
if(numbers == 21 || numbers == 22 ||numbers == 23){

COST2 += Number(ADLT_MBR_REG_NUM)+Number(COL_MBR_REG_NUM)+Number(JOI_MBR_REG_NUM)+Number(ADLT_LCH_NUM)+Number(CHLD_LCH_NUM)+Number(ADLT_DIN_NUM)+Number(CHLD_DIN_NUM)+Number(ADLT_BFT_NUM)+Number(FST_TMR_NUM) ;

jQ("input[name='COST2']").val(parseFloat(COST2).toFixed(2));
}
if(numbers == 31 || numbers == 32 ||numbers == 33){

COST3 += Number(ADLT_MBR_REG_NUM)+Number(COL_MBR_REG_NUM)+Number(JOI_MBR_REG_NUM)+Number(ADLT_LCH_NUM)+Number(CHLD_LCH_NUM)+Number(ADLT_DIN_NUM)+Number(CHLD_DIN_NUM)+Number(ADLT_BFT_NUM)+Number(FST_TMR_NUM) ;

jQ("input[name='COST3']").val(parseFloat(COST3).toFixed(2));
}
if(numbers == 41 || numbers == 42 ||numbers == 43){

COST4 += Number(ADLT_MBR_REG_NUM)+Number(COL_MBR_REG_NUM)+Number(JOI_MBR_REG_NUM)+Number(ADLT_LCH_NUM)+Number(CHLD_LCH_NUM)+Number(ADLT_DIN_NUM)+Number(CHLD_DIN_NUM)+Number(ADLT_BFT_NUM)+Number(FST_TMR_NUM) ;

jQ("input[name='COST4']").val(parseFloat(COST4).toFixed(2));
}
if(numbers == 51 || numbers == 52 ||numbers == 53){

COST5 += Number(ADLT_MBR_REG_NUM)+Number(COL_MBR_REG_NUM)+Number(JOI_MBR_REG_NUM)+Number(ADLT_LCH_NUM)+Number(CHLD_LCH_NUM)+Number(ADLT_DIN_NUM)+Number(CHLD_DIN_NUM)+Number(ADLT_BFT_NUM)+Number(FST_TMR_NUM) ;

jQ("input[name='COST5']").val(parseFloat(COST5).toFixed(2));
}
});
calctotal();
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))
}

});

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

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.