Hello everyone
I could use a little line of JS (I presume) for what I believe may be only a little tweak for someone with more skills than mine😉
I have two dropdowns. One ('teams') has values 1,2 and 3. A second dropdown (here:'judges') offers values up to eight. Any 'judges' participating in the event pay 180 EUR. If, however, there are +1 more judges than teams they get a discount, so the part. fee is 160, not 180 for each of those judges. Likewise, if there are +2 or more than # of teams, the discount part. fee is 140€. There are no discounts if the # of judges are equal to the # of teams.
Example: one team brings 2 judges (n+1) - both judges pay 160, so the discount on the delegation is 2*20
Example: two teams bring 6 judges (n+2 or more) - all six pay 140, so the discount on the delegation is 6*40 EUR.
Example: three teams bring three judges - no discounts. All pay 180.
I've got the 'Prospective fees' textbox to show the values * 180 only, but they would be less, of course, if the values in 'judges' are +1 or +2 than the values in 'teams'.
I assume, this would demand a simple 'if-then' programming, of which I don't know what it should look like. Any help would be much appreciated.
Please check the following image for clarification. Here, there are five participants altogether, adding up to 900€ (5*180), but with two n+1 judges, it should be 860€ (3*180 + 2*160):

This is the JS event for the 'Prospective fee' box {total}:
Thanks and Happy New Year!
Chris
I could use a little line of JS (I presume) for what I believe may be only a little tweak for someone with more skills than mine😉
I have two dropdowns. One ('teams') has values 1,2 and 3. A second dropdown (here:'judges') offers values up to eight. Any 'judges' participating in the event pay 180 EUR. If, however, there are +1 more judges than teams they get a discount, so the part. fee is 160, not 180 for each of those judges. Likewise, if there are +2 or more than # of teams, the discount part. fee is 140€. There are no discounts if the # of judges are equal to the # of teams.
Example: one team brings 2 judges (n+1) - both judges pay 160, so the discount on the delegation is 2*20
Example: two teams bring 6 judges (n+2 or more) - all six pay 140, so the discount on the delegation is 6*40 EUR.
Example: three teams bring three judges - no discounts. All pay 180.
I've got the 'Prospective fees' textbox to show the values * 180 only, but they would be less, of course, if the values in 'judges' are +1 or +2 than the values in 'teams'.
I assume, this would demand a simple 'if-then' programming, of which I don't know what it should look like. Any help would be much appreciated.
Please check the following image for clarification. Here, there are five participants altogether, adding up to 900€ (5*180), but with two n+1 judges, it should be 860€ (3*180 + 2*160):

This is the JS event for the 'Prospective fee' box {total}:
window.addEvent('domready', function() {
$('debaters').addEvent('change', rekenen1);
$('judges').addEvent('change', rekenen1);
});
function rekenen1(){
$('total').value = $('debaters').value * 180 + $('judges').value * 180;
}
Thanks and Happy New Year!
Chris