I have a model form field that is declared as an array .
<?= $form->field($model, 'percentage[]'
, ['options'=>['class'=>''] 'labelOptions'=>['class'=>'text-dark-blue text12 required-star']
, 'wrapperOptions'=>['class'=>'']
]) ->widget(MaskedInput::classname(), ['options'=>['class'=>"form-control text-right", 'tabindex' => 2, 'maxlength' => 14],
'clientOptions' => [
'alias' => 'decimal',
'digits' => 2,
'digitsOptional' => false,
'autoUnmask'=> true,
'groupSeparator' => ',',
'autoGroup' => true,
'removeMaskOnSubmit' => true,
],
])->textInput(['placeholder'=>'','class'=>'form-control text-right','value'=> $data['percentage']])->label('Sq. Ft.')->label(false);
?>
The model validation not working for this fields
My validation Code is here
[['percentage'], 'compare', 'compareValue' => 0, 'operator' => '>'],
[['percentage'], 'compare', 'compareValue' => 100, 'operator' => '<='],
How can I solve this issue?
Thanks,
Maya A