Forums

How to multiply field values without clicking a button

AFROSET 27 Sep, 2018
I want an automatic calculations when I input value to fieldvalue1 of fieldnameA and the value is multiply by 4 which will auto appear on fieldvalue2 of fieldnameB And finally the input in A and the results in B can be submitted with any other form field.

Note: am using multi field for A and B.

please how can I go about doing this.



GreyHead 27 Sep, 2018
1 Likes
Hi Afroset,

That sounds like a case for Custom JavaScript.

Bob
AFROSET 27 Sep, 2018
So, how can I go about it.
AFROSET 27 Sep, 2018
<script type="text/javascript">
window.addEvent('domready', function() {
jQuery('Amount_in_Dollar').addEvent('change', function() {
jQuery('Amount_in_naira') = jQuery('Amount_in_Dollar').value*10;
});
});
</script>
healyhatman 28 Sep, 2018
1 Likes
jQuery('field identifier').val() to get the value
jQuery('field identifier').val(some value) to set the value
AFROSET 29 Sep, 2018
Did you mean this
<script type="text/javascript">window.addEvent('domready', function() { jQuery('Field ID1').val() { jQuery('Field ID2') = jQuery('Field ID1').val(*10); });});</script>for better understanding @healyhatman and @ GreyHead can you please rewrite the code fully for me. with instructions on how to go about it on CF v5 . I'll be so greatful





healyhatman 29 Sep, 2018
1 Likes
<script type="text/javascript">window.addEvent('domready', function() {
jQuery('Amount_in_Dollar').addEvent('change', function() {
jQuery('input[name="Amount_in_naira"]').val(jQuery('input[name="Amount_in_Dollar"]').val() * 10);
});
});
</script>
This topic is locked and no more replies can be posted.