Re: Numbers Only in WOTextField
Re: Numbers Only in WOTextField
- Subject: Re: Numbers Only in WOTextField
- From: David Avendasora <email@hidden>
- Date: Tue, 10 Nov 2009 15:21:29 -0500
On Nov 10, 2009, at 3:07 PM, Chuck Hill wrote:
On Nov 10, 2009, at 11:52 AM, David Avendasora wrote:
Never mind! Great minds think alike, right Lon?
http://lists.apple.com/archives/webobjects-dev/2009/Oct/msg00342.html
And not so great minds don't read the docs? :-P
What?! There's docs now? :-P
WOTextField extends WODynamicElement, not WOComponent.
WODynamicElement same same, but very different. No have template.
The WODynamicElements are not really intended to be sub-classed.
There were not written with that in mind. You will pretty much have
to re-implement it. The other approach is to wrap it in a
WOComponent and, yes, pass in all the possible bindings.
Yeah, I jumpt to a conclusion. I saw the subject "Subclassing a
Component" and that you had responded with something that wasn't quite
completely clear to me at first and thought, well it must be just over
my head. I'll figure it out eventually.
Once I figured out that it wasn't at all what I was talking about, you
(and Ricardo) had already busted me.
Dave
x`
You might also be able to add to the bindings in Application using
public WOElement dynamicElementWithName(String aName,
NSDictionary<String,WOAssociation> someAssociations, WOElement
anElement, NSArray<String> aLanguageArray)
Chuck
On Nov 10, 2009, at 2:29 PM, David Avendasora wrote:
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
*****
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
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