SAN CAZIANO wrote:
how can i test if I paste in an edit if the new value contains only numbers
and one ',' to test if I paste only a float ???
If that is /exactly/ what you want:
Enter a value (<i>x,x</i>)
<input type="text" id="xx" size="10" onblur="
checkVal(this.value);">
<script type="text/javascript">
function checkVal(x){
alert((/^\d+,\d+$/.test(x))? 'OK' : 'ughh');
}
</script>
The above will fail on any value that is not one or more digits, then
a comma, then one or more digits. It will not tolerate any spaces
before or after the expression, or any other character.
Beware: using a comma ',' for a decimal point '.' may be confusing to
many visitors not familiar with that notation and who expect it to be
used for a thousands separator.
--
Rob