You'll probably need to do something like this using jQuery (or the javascript framework of your choice). If you have textboxes similar to these:
<input type="text" class="decimal" value="0.00"/>
Then you can add a couple of event handlers for when users enter and exit these textboxes:
$('input.decimal').focusin(function() {
if ($(this).val() === '0.00') {
$(this).val('');
}
});
$('input.decimal').focusout(function() {
var value = parseFloat($(this).val());
if (isNaN(value)) {
$(this).val('0.00');
} else {
$(this).val(value.toFixed(2));
}
});
You'll probably need to add some extra code to cover pasting into the text boxes. You can take a look at
an example on jsfiddle[
^].