Hi
I would like to display the result of a simple calculation like
field1*30+field2*40
I've tried this code :
found it in the forum..
got field1 and 2 as text boxes, and box3 as a text box.
when debugging I get this message :
Data Array:
Array
(
[option] => com_chronoforms
[chronoform] => myform
[event] => submit
[Itemid] =>
[2sidd] => 1
[input_text_2] => 2
[input_text_3] =>
[input_submit_1] => Submit
[46b198acc9ea0488e3b22a0195ce67df] => 1
)
Validation Errors:
Array
(
)
I would like to have the result to be displayed in "box3" either when hitting submit or on changes made to field 1 or 2... any suggestion?
thanx
I would like to display the result of a simple calculation like
field1*30+field2*40
I've tried this code :
window.addEvent('myform', function() {
$('field1').addEvent('change', calculate);
$('field2').addEvent('change', calculate);
});
function calculate() {
var sum = parseInt( $('field1').value ) + parseInt( $('field2').value );
if ( isNaN(sum) ) {
sum = '';
}
$('box3').value = sum;
};
found it in the forum..
got field1 and 2 as text boxes, and box3 as a text box.
when debugging I get this message :
Data Array:
Array
(
[option] => com_chronoforms
[chronoform] => myform
[event] => submit
[Itemid] =>
[2sidd] => 1
[input_text_2] => 2
[input_text_3] =>
[input_submit_1] => Submit
[46b198acc9ea0488e3b22a0195ce67df] => 1
)
Validation Errors:
Array
(
)
I would like to have the result to be displayed in "box3" either when hitting submit or on changes made to field 1 or 2... any suggestion?
thanx