Hi,
In my form, user can register to different activities (one field for each). Theses activities have different costs.
at the very end of the form, user has to calculate the amount to pay depending on the activities he chose.
I don't think this is possible but is there a way to add automatically numbers from different fields in the last field ?
Thanks for your job !
Chronoforms_V4_RC3.5.1_J1.5
(5 domains Subscription licence)
In my form, user can register to different activities (one field for each). Theses activities have different costs.
at the very end of the form, user has to calculate the amount to pay depending on the activities he chose.
I don't think this is possible but is there a way to add automatically numbers from different fields in the last field ?
Thanks for your job !
Chronoforms_V4_RC3.5.1_J1.5
(5 domains Subscription licence)
Hi Repitol,
Yes, you can use JavaScript to do that. You'll find some examples here if you search on 'calculate' (try the ChronoSearch from the Tutorials link above). You'll find many more if you use Google search generally.
Each calculation is different so it's not possible to provide much more than very general help here.
Bob
Yes, you can use JavaScript to do that. You'll find some examples here if you search on 'calculate' (try the ChronoSearch from the Tutorials link above). You'll find many more if you use Google search generally.
Each calculation is different so it's not possible to provide much more than very general help here.
Bob
Hi Bob,
thanks for your quick reply !
That's great ! I need a very simple method for a simple form
eg:
field A - price in euro (text box) : 20
field B - price in euro (text box) : 30
total to be paid (Field C) : 50
That's all. I'll take a look at the search as you suggest
Best regards
Repitol
thanks for your quick reply !
That's great ! I need a very simple method for a simple form
eg:
field A - price in euro (text box) : 20
field B - price in euro (text box) : 30
total to be paid (Field C) : 50
That's all. I'll take a look at the search as you suggest
Best regards
Repitol
Sorry,
here is the JS code I tried but it seems there's a problem. The last field ('total_a_payer') stays empty.
I put this code in a Load JS action within the OnLoad event
Id's are those declared in "Field Id" area for each input
Do I have to change anything in fields (configuration / General) ?
Repitol confused....
here is the JS code I tried but it seems there's a problem. The last field ('total_a_payer') stays empty.
I put this code in a Load JS action within the OnLoad event
Id's are those declared in "Field Id" area for each input
Do I have to change anything in fields (configuration / General) ?
window.addEvent('domready', function() {
$('total_soiree_dansante').addEvent('change', rekenen1);
$('total_coupe').addEvent('change', rekenen1);
$('total_ski_seul').addEvent('change', rekenen1);
$('total_buffet').addEvent('change', rekenen1);
$('total_soiree_pyreneenne').addEvent('change', rekenen1);
$('total_ski_libre').addEvent('change', rekenen1);
});
function rekenen1(){
$('total_a_payer').value = $('total_soiree_dansante').value + $('total_coupe').value + $('total_ski_seul').value + $('total_buffet').value + $('total_soiree_pyreneenne').value + $('total_ski_libre').value;
}
Repitol confused....
Hi Repitol,
The code looks OK to me.
Do you see any errors in the JavaScript Console in your web browser?
Bob
The code looks OK to me.
Do you see any errors in the JavaScript Console in your web browser?
Bob
Hi,
Error message !! Right !
Maybe something I miss but I don't know where unfortunately.
Every Field Ids are checked and are ok (in text boxes / configure / general / FieldID)
The code is on LoadJS event (OnLoad panel)
Form saved.
No code in the last field (total-a-payer) except FieldID. This field is a text box.
When I use the form, whatever the number I write, the last field stays empty.
Don't know what to check... 😟
Error message !! Right !
Horodatage : 20/02/13 10:15:25
Erreur : TypeError: $(...) is null
Fichier Source : (here is the website url)
Ligne : 62
Maybe something I miss but I don't know where unfortunately.
Every Field Ids are checked and are ok (in text boxes / configure / general / FieldID)
The code is on LoadJS event (OnLoad panel)
Form saved.
No code in the last field (total-a-payer) except FieldID. This field is a text box.
When I use the form, whatever the number I write, the last field stays empty.
Don't know what to check... 😟
http://www.2emecoupefranceskige.fr/demo/
Do you need access to backend ? If yes I'll send login by Private Mail
Thanks a lot for your help
Do you need access to backend ? If yes I'll send login by Private Mail
Thanks a lot for your help
Hi Repitol,
There is no element with the id=total_ski_libre, it's in the title attribute instead of the id:
Bob
There is no element with the id=total_ski_libre, it's in the title attribute instead of the id:
<input type="text" name="input_text_69" value="" title="total_ski_libre" class=" validate['required','number']" size="30" maxlength="150">
Bob
Hi Repitol,
It's working OK here but concatentating the values i.e. 15+48 = 1548 instead of adding them. Please try
Bob
It's working OK here but concatentating the values i.e. 15+48 = 1548 instead of adding them. Please try
$('total_a_payer').value = parseInt($('total_soiree_dansante').value) + parseInt($('total_coupe').value) + parseInt($('total_ski_seul').value) + parseInt($('total_buffet').value) + parseInt($('total_soiree_pyreneenne').value) + parseInt($('total_ski_libre').value);
Bob
Bob,
with your new code there's a big change : the field calculates !
but the result is still wrong
60 + 25 + 22 + 50 + 100 + 220 = 60252250100220
you're close to fix my problem !
with your new code there's a big change : the field calculates !
but the result is still wrong
60 + 25 + 22 + 50 + 100 + 220 = 60252250100220
you're close to fix my problem !
Sorry, it doesn't calculate anymore.
I've tried a new test but the field stays empty. I'm really confused.
the code I use
I've tried a new test but the field stays empty. I'm really confused.
the code I use
window.addEvent('domready', function() {
$('total_soiree_dansante').addEvent('change', rekenen1);
$('total_coupe').addEvent('change', rekenen1);
$('total_ski_seul').addEvent('change', rekenen1);
$('total_buffet').addEvent('change', rekenen1);
$('total_soiree_pyreneenne').addEvent('change', rekenen1);
$('total_ski_libre').addEvent('change', rekenen1);
});
function rekenen1(){
$('total_a_payer').value = parseInt($('total_soiree_dansante').value) + parseInt($('total_coupe').value) + parseInt($('total_ski_seul').value) + parseInt($('total_buffet').value) + parseInt($('total_soiree_pyreneenne').value) + parseInt($('total_ski_libre').value);}
IT WORKS !!
I've tried on Safari and it calculates with no error
tried on Firefox, empty caching, it stays with empty field. maybe a problem with my Firefox caching.
I'll make another test and gives you the result.
I've tried on Safari and it calculates with no error
tried on Firefox, empty caching, it stays with empty field. maybe a problem with my Firefox caching.
I'll make another test and gives you the result.
Ok Bob,
that's ok. It works fine. 😀
Thanks again for the time you gave me.
Have a good day !
that's ok. It works fine. 😀
Thanks again for the time you gave me.
Have a good day !
Hi Bob,
last question : How can I put € sigle automatically in the last field (total_a_payer) ?
With current code, the field shows only the amount
I'd like amount in € like 230€ and not only 230.
Thanks
(I've noticed a bug with email value when using print button code given in your FAQ. on the print, email appears twice ie: [email]bob@chronoengine.combob[/email]@chronoengine.com)
Maybe you have a fix for that ?
Thanks
best regards
Repitol
last question : How can I put € sigle automatically in the last field (total_a_payer) ?
With current code, the field shows only the amount
I'd like amount in € like 230€ and not only 230.
Thanks
(I've noticed a bug with email value when using print button code given in your FAQ. on the print, email appears twice ie: [email]bob@chronoengine.combob[/email]@chronoengine.com)
Maybe you have a fix for that ?
Thanks
best regards
Repitol
Hi Repitol,
You could just add the HTML for a euro sign at the end of the string you calculate in the JavaScript.
There's nothing in the print code that will duplicate the email address - it may be because you have the Joomla! Email cloaking plugin turned on?
Bob
You could just add the HTML for a euro sign at the end of the string you calculate in the JavaScript.
There's nothing in the print code that will duplicate the email address - it may be because you have the Joomla! Email cloaking plugin turned on?
Bob
well, the HTML code for € is
when I use it in the JS code and apply, it turns to € and the JS doesn't work anymore.
I think that's because I don't put it at the good place, I'm under newbee level at Javascript.
So I put it in the form html code (form edit not wizard mode) and it goes well).🙂
Joomla! Email cloaking plugin
Wazaaat ? :?
When using Thanks Message template after subit, it shows e-mail with no problem
(called by string
when I use "print button"
page shows and print emailemail (maybe because it uses
€
when I use it in the JS code and apply, it turns to € and the JS doesn't work anymore.
I think that's because I don't put it at the good place, I'm under newbee level at Javascript.
So I put it in the form html code (form edit not wizard mode) and it goes well).🙂
Joomla! Email cloaking plugin
Wazaaat ? :?
When using Thanks Message template after subit, it shows e-mail with no problem
(called by string
<td>{email}</td>
)when I use "print button"
page shows and print emailemail (maybe because it uses
<a href="mailto:email">email</a>
?)
Hi Repitol,
Please try:
Bob
Please try:
. . .
$('total_a_payer').value = parseInt($('total_soiree_dansante').value) + parseInt($('total_coupe').value) + parseInt($('total_ski_seul').value) + parseInt($('total_buffet').value) + parseInt($('total_soiree_pyreneenne').value) + parseInt($('total_ski_libre').value) + ' €';
. . .
Bob
This topic is locked and no more replies can be posted.