Hi guys
I am trying to create a form with a multiplier component. In each multiplier, I have three fields of interest: a dropdown (which affects the $ rate, which I'm storing in a hidden field), a list of check boxes (which I want to count to give a # of nights) and a text box in which I want to show the resulting cost (it's a booking system for a community event). I want to make the calculations as people make changes, not after they have submitted, so they can see the costs they are committing to.
I have created the fields as:
I used the LoadJS component to create a function that can set the hidden Rate field as follows:
I then created an Event as follows:
However this is not working, as the generated code for the events has the ## in it rather than something that will be row dependent.
I am new to CF, but have been a programmer for 30+ years. I suspect I am either barking up the wrong tree or seriously missing something here! I've scoured the Forums and the tutorials, but can't see anything to help (although I learned a lot form the new multiplier tutorial).
Any suggestions?
Regards
David
I am trying to create a form with a multiplier component. In each multiplier, I have three fields of interest: a dropdown (which affects the $ rate, which I'm storing in a hidden field), a list of check boxes (which I want to count to give a # of nights) and a text box in which I want to show the resulting cost (it's a booking system for a community event). I want to make the calculations as people make changes, not after they have submitted, so they can see the costs they are committing to.
I have created the fields as:
Type - Name = registrant[##][type], id = regType##
Nights - Name = registrant[##][nights], id = regNights##
Cost - Name = registrant[##][cost], id = regCost##
I used the LoadJS component to create a function that can set the hidden Rate field as follows:
function setRegRate(reg) {
var rate,type;
type = $('#regType'+reg).val();
switch( type ) {
case "A": rate = 24; break;
case "P": rate = 20; break;
case "C": rate = 15; break;
case "I": rate = 0; break;
case "D": rate = 6; break;
}
$('#regRate'+reg).val = rate;
}
I then created an Event as follows:
On Change Value of registrant[##][type] Function setRegRate(##).
However this is not working, as the generated code for the events has the ## in it rather than something that will be row dependent.
I am new to CF, but have been a programmer for 30+ years. I suspect I am either barking up the wrong tree or seriously missing something here! I've scoured the Forums and the tutorials, but can't see anything to help (although I learned a lot form the new multiplier tutorial).
Any suggestions?
Regards
David