Set Integer Input Field Default Value To Empty String

In form Integer input fields are displaying 0 as default value is there any way we can set to empty string?

Let’s say you hold the integer value in the model’s attribute as follow:


$model->ref_no

In your view, use following code:




if (empty($model->ref_no)) $model->ref_no = '';

echo $form->textField($model, 'ref_no');



Hope this can help.