A form that adds up total - Post ID...

User 2246262 Photo


Registered User
4 posts

Hi There,
I would like to create 5 fields which users can add a number or score and then for the totals of each to be added up.

Example:
Score 1 = 5
Score 2 = 15
Score 3 = 10
Score 4 = 20
Score 5 =50
GRAND TOTAL = 100
Is there any way or anyone that can do that for me? Happy to pay someone.
See attached for general layout.
Cheers
Peter
Attachments:
User 187934 Photo


Senior Advisor
20,239 posts

Hi PMUSCET,
Yes this can be done.
Can you share a link to your form so I can see the actual inputs.
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 2246262 Photo


Registered User
4 posts

Hi Eric,
here is the link http://www.wineshowcasemedia.com/wine%2 … te%20form/
I have not populated all the drop down numbers & the first one showing 50 should not have any other numbers as that is the starting base.
Cheers
Peter
User 187934 Photo


Senior Advisor
20,239 posts

This should work for ya based on given info.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
//ver 1
var jQ = $.noConflict(true);
jQ(document).ready(function(){
jQ('input[name="text20"]').prop('readonly','true');
jQ('select').on('change', function() {
var sum_total = 0;
jQ('select').not(jQ('select[name="select1"]')).each(function(){
var amount = parseInt(jQ(this).val());
if(amount > 0){
sum_total += parseFloat(this.value);
jQ('input[name="text20"]').val(sum_total);
}
});
}).change();
});
</script>

Working here.
https://ericrohloff.com/coffeecup/ccfor … form1.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 2246262 Photo


Registered User
4 posts

Thank you Eric,
Very clever... What is your fee for this?
There is one other adjustment as the 50 base points should be on top of the other points below so score nomally sits between 75 to 95 points in total.
Finally what do I actually do with the script you sent? It may be beyond my knowledge?
Cheers
Peter
User 187934 Photo


Senior Advisor
20,239 posts

Code adjusted. Always at least 50 points.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
// ver 2
var jQ = $.noConflict(true);
jQ(document).ready(function(){
jQ('input[name="text20"]').prop('readonly','true');
jQ('select').on('change', function() {
var sum_total = 0;
jQ('select').not(jQ('select[name="select1"]')).each(function(){
var amount = parseInt(jQ(this).val());
if(amount > 0){
sum_total += parseFloat(this.value);
jQ('input[name="text20"]').val(sum_total+50);
}
});
}).change();
});
</script>

Place an html element into your form and paste the code into it. I usually put them at the very top but it doesn't really matter. Enjoy.:cool:
Working here.
https://ericrohloff.com/coffeecup/ccfor … form2.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 2246262 Photo


Registered User
4 posts

Wow thank you... I got it working. Happy to pay you something for this...
Cheers
Peter

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.