$js =<<<JSCONTENT
window.maskMoney_0fa5526f = {"prefix":" Rp ","suffix":" ,-","precision":0,"affixesStay":true,"thousands":",","decimal":".","allowZero":true,"allowNegative":true};
JSCONTENT;
$this->registerJs($js, View::POS_HEAD);
$js2 = <<<JSCONTENT
jQuery("#w13-disp").maskMoney(maskMoney_0fa5526f);
var val = parseFloat(jQuery("#w13").val());
jQuery("#w13-disp").maskMoney('mask', val);
jQuery("#w13-disp").on('change keyup', function (e) {
if (e.type ==='change' || (e.type === 'keyup' && (e.keyCode == 13 || e.which == 13))) {
var out = jQuery("#w13-disp").maskMoney('unmasked')[0];
jQuery("#w13").val(out).trigger('change');
}
});
JSCONTENT;
$this->registerJs($js2);
The Scripts Above Works for the price Format,
i use it in this Script for example
<input type="text" id="w13-disp" class="form-control" name="w13-disp" value="1000">
But if i Use Active Form how to insert the JQuery ?
The Form Script
<?= $form->field($model, 'price')->textInput(['type' => 'number','placeholder' => 'Harga Jual'])?>