I try with this code does not work.
$rsnew['pendiente']= str_replace(',', '.', $rsnew['pendiente']);
and
$rsnew['pendiente'] = floatval(ereg_replace("[^-0-9\.]"."",$rsnew['pendiente']));
I try with this code does not work.
$rsnew['pendiente']= str_replace(',', '.', $rsnew['pendiente']);
and
$rsnew['pendiente'] = floatval(ereg_replace("[^-0-9\.]"."",$rsnew['pendiente']));
the problem is that when a customer enters a number with comma "12,12" in a field that is validated float
jumps an error message, as it should be.
I would like is to create a function in which the customer
If you enter both a number with comma or dot. correct this before automatically.
so do not give the error message.
It is possible?
You may add your change event to the field to replace comma with dot (Client Scripts->Table-Specific->Add/Copy Page->Startup Script), like:
$(function() {
$("#x<yourfield>").change(function() { // replace <yourfield> with your actual field name
var val1 = $("#x<yourfield>").val();
val1 = val1.replace(/,/g, '.'); // replace all ',' with '.', assume your field only have one comma
$("#x_<yourfield>").val(val1);
});
});
So, you can use Validate: Float for your validation.