Hi @trongtri35,
I’m afraid that there’s no such option at the moment but this add-on from my teammate would do the trick for that:
https://gist.github.com/wpmudev-sls/ef388f11a3ef68ef0e968be061d46f1e
You can find comments in the code on how to set it up after installation.
Cheers,
Predrag
Thank you Predrag so much, it work like a charm.
in my case. insert jQuery instead of install plugin.
* Note, to make this work:
* 1. Enable load form using Ajax on Behaviour tab
* 2. Add class name wpmudev-calculation into calculation field (Calculation field settings -> Styling tab)
*/
jQuery( document ).ready(function($) {
function formatNumber(nStr, decSeperate, groupSeperate) {
nStr += "";
x = nStr.split(decSeperate);
x1 = x[0];
x2 = x.length > 1 ? "." + x[1] : "";
for (var rgx = /(\d+)(\d{3})/; rgx.test(x1); )
x1 = x1.replace(rgx, "$1" + groupSeperate + "$2");
return x1 + x2
}
$(document).on('after.load.forminator', function(e, _form_id){
$('#forminator-module-'+ _form_id).find('.wpmudev-calculation .forminator-calculation').on('change', function(){
let _this = $(this),
_next = _this.next(".forminator-input");
if( ! _next.length ){
_this.after('<input type="text" class="forminator-input" value="'+ formatNumber( _this.val(), '.', ',') +'" disabled="true" />');
_this.hide();
}else{
_next.val( formatNumber( _this.val(), '.', ',') );
}
});
});
});