wbraganca/yii2-dynamicform

Kartik Number Control.

stovesy opened this issue · 3 comments

Has anyone made any modifications to DynamicForm to get the Kartik Number control working?

Validation fails and the mask function does not copy to a new form entry.

Thanks

Did you find any solution?

i got this solution from https://demos.krajee.com/number#comments

Try to put following code in yii-dynamic-form.js (remember to delete web/assets files to make it effect)

// "kartik-v/yii2-numbercontrol"
var $hasNumberControl = $(widgetOptionsRoot.widgetItem).find('[data-krajee-numbercontrol]');
if ($hasNumberControl.length > 0) {
$hasNumberControl.each(function() {
var configNumberControl = eval($(this).attr('data-krajee-numbercontrol'));
configNumberControl.displayId = $(this).parent().prev().attr('id');
if ($(this).data('numberControl')) { $(this).numberControl('destroy'); }
$(this).numberControl(configNumberControl);
});
}