• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Numbers Only in WOTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Numbers Only in WOTextField


  • Subject: Numbers Only in WOTextField
  • From: David Avendasora <email@hidden>
  • Date: Tue, 10 Nov 2009 14:29:58 -0500

Hi all,

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


David Avendasora
Senior Software Engineer
K12, Inc.

*****
WebObjects Documentation Wiki : http://wiki.objectstyle.org/confluence/display/WO/
*****
WebObjects API: http://developer.apple.com/legacy/mac/library/documentation/MacOSXServer/Reference/WO54_Reference/index.html
*****

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Numbers Only in WOTextField
      • From: Kieran Kelleher <email@hidden>
    • Re: Numbers Only in WOTextField
      • From: David Avendasora <email@hidden>
  • Prev by Date: Re: compound pk
  • Next by Date: Re: Numbers Only in WOTextField
  • Previous by thread: Re: compound pk
  • Next by thread: Re: Numbers Only in WOTextField
  • Index(es):
    • Date
    • Thread