Okay, brace yourselves, this isn't a Java Client testimonial!
There are lots of places in our Web apps where we have a WOTextField that should only ever be given numbers. I don't want to deal with any chance that anything other than numbers will be passed on the server, so I added this _javascript_ to the page:
<script language = "_javascript_">
<!--
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
//-->
</script>
And added this binding to the WOTextField: onkeypress="return isNumberKey(event)"
This works great. Exactly what I want, but I have literally hundreds of places that I need to use this, and since the code will always be the same, is it possible to simply extend WOTextField so all I have to do is simply replace calls to WOTextField with MYNumberField without having to manually pass through all of WOTextField's bindings (value = ^val)
Thanks!
Dave