<?php

namespace apexl\Io\modules\formbuilder\includes;

use apexl\Io\modules\formbuilder\includes\formField;

class numberField extends formField
{
    public function __construct($name)
    {
        parent::__construct($name, 'input', 'number');
    }

    public function setValue($value){ // this is required to fix the VueJS bug, where 0 values are being converted to empty strings
        if (is_numeric($value)) $value = (string)$value;
        $this->field->value = $value;
        return $this;
    }
}