Dcat 金额输入框提交时去掉千分位逗号

Dcat 金额输入框  $form->currency('price') ,当输入的值比较大时,会自动加上千分位逗号,提交到后台可能导致一些验证码规则执行错误。

我们可以在 bootstrap.php 里面加入下面的代码,让表单在提交前自动去掉千分位逗号:

// 金额输入组件提交的时候自动去掉逗号
Form\Field\Currency::resolving(function (Form\Field\Currency $currency) {
    $currency->options(['autoUnmask' => true]);
});

 

分类至 PHP
0条评论