Hi Kieran,
Where can I find that - I'd love to watch it....
Regards,
David.
On Nov 10, 2009, at 10:19 PM, Kieran Kelleher wrote:
David,
Easy way ... just make a custom stateless reusable component
"SmartNumberTextField.wo" or whatever you want to call it. Make it
binding compatible with WOtextfield so you can just change the
component name in wod. I do this for date fields. I have one component
WKDateField that has a default date formatter and a javascript
calendar widget. When I want to change the widget behaviour or switch
to a different calendar widget, I just change the one component.
Basically you should be building a framework of reusable stateless
WOComponents that you can re-use in apps over and over. The goal is
"do not repeat yourself" and productivity.
BTW, use Wonder AjaxUtils or ERIncludeOncePerRequest (or whatever
that's called) to stuff the javsscript snippet into the head or the
page only once.
Also, for inspiration on Reusable Components, it is worthwhile to
watch Session 614 "Reusable Components" from WWDC 2003.
Regards, Kieran
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
*****
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/david%40infinityspain.com
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]