Forums

How to hide Default Value

niwesa 08 Feb, 2013
On my form people can add a price. To create points between numeric values in some textfields i use a a custom scrip;

<?php
$form->data['waarde_1'] = number_format($form->data['waarde_1'], 0, ',', '.'); 
$form->data['waarde_2'] = number_format($form->data['waarde_2'], 0, ',', '.');
$form->data['waarde_3'] = number_format($form->data['waarde_3'], 0, ',', '.');  
?>


But this only works when i use a Field Default Value, in this case i use 0 .

But when people removes this 0 there is a error after submitting. How can i hide the Field Default Value?
GreyHead 09 Feb, 2013
Hi niwesa,

PHP only works on the server before the form is loaded and after it is submitted. It has no effect whatsoever when the user makes changes in their browser.

You can add thousands markers and decimal points with JavaScript but it can get quite complicated to keep track of the changes and t make sure that you store the correct values.

Bob
This topic is locked and no more replies can be posted.