The JS is the easy part. What I'm trying to understand is how to allow arbitrary (client side) components to be provided as parameters to the mixin. In reality all that needs to happen is a JS object needs to be provided so that it can receive and handle the key events. If I wanted it to be dirty, I could require that the parameter to the mixin is just a string that represents the instantiated JS object on the client side. But I feel there's a way to do this cleanly, and at least have Tapestry assure the developer that the provided component exists (etc) by throwing an exception.

PS I'm not a fan of DoJo, and to my fortune prototype happens to be the library of choice for me and Tapestry. Of course this doesn't matter, and I appreciate your feedback.

chris

andyhot wrote:
Dojo has the concept of registering for events and publishing events - so, the mixin could emit js that publishes
a set of custom events

Event content could follow any protocol you decide, either json
{nodeId:'textarea1', charsLeft:50, message:''} or even a string
textarea1|50|
and it would be published with dojo.event.publish(eventSlot, eventContent)

Then the displayer could be set up to listen for all messages of that specific slot using dojo.event.subscribe(eventSlot, myHandlerObject, 'onEvent');

Anyway, perhaps you can do something similar to handle events in any js toolkit.


Chris Lewis wrote:
Hello again,

I've been working on a mixin that will count the characters typed into a TextField or TextArea, as they are typed. It works fine but among other things, I want to make it possible to control where and how user feedback is displayed. My mixin just implements the counting logic, but it should be possible for a user to use this mixin and configure it to display a counter, implement text-length restriction (something not possible for html text areas without JS), and implement notification. How should I go about doing this? I could easily have a domId parameter on the mixin that would receive the counter notifications, but I'd rather make it easy for one to plug in their own logic and receive these notifications as events. Obviously that part would happen in client-side JS, but I want the framework to coordinate the two (ensuring the components exist, etc). Does anyone have any thoughts on this?

sincerely,
chris

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to