Just as the live text field we will use the same parameters, but the inputType will be "number" and it is important to add a few attributes, like step and min. Step allows decimals, in the following example 2 decimals, one decimal at a time.
For Decimals
array_push($td_fields,[ 'type'=>'live', 'inputType' => 'number', 'col'=>'balance', 'privilege'=> 2, //optional, 4 will show the field only to High and Admin privileges, default is 1 'class'=>'', //optional, class name selector default: none (empty) 'attributes'=>'min="0" step=".01"' //optional ]);
For Integers
For integers use step=1 and validate the value on the server. Browser constraints do not replace server validation.
array_push($td_fields,[ 'type'=>'live', 'inputType' => 'number', 'col'=>'balance', 'privilege'=> 2, //optional, 4 will show the field only to High and Admin privileges, default is 1 'class'=>'', //optional, class name selector default: none (empty) 'attributes'=>'min="0" step="1"' //optional ]);