Signals and Slots question...

Robert Hedin <[email protected]> Sun, 06 Mar 2005 13:15:02 -0500
Newsgroups gmane.comp.windows.devel.netwindows
Message-ID <[email protected]>
Hi all!

I've got a series of forms based on rows returned from a database, all 
being created dynamically. There is one form for each row in the 
database. For one of the fields, I need to execute some javascript 
(onBlur, onFocus, whatever). This JS is common for all rows, but affects 
only the field the user currently has selected (i.e. maybe it converts 
the text entered to upper case or whatever -- the actual action is 
immaterial).

The upshot is I kind of need access to "this" for a particular event-- 
i.e. the context in which the event is firing.

The only thing I've been able to figure out is to create a "pre" signal 
first for each field that sets a global variable to point to the current 
context:
i.e.:
declare this globally:
var CURRENT_FIELD;

and then for each field do something like this:
__sig__.connectByName( domNode, "onfocus", null, __sig__.setAnonFunc( 
new Function( "", "CURRENT_FIELD = 
document.forms['formname'].elements['fieldname'];")));

(where this is output for each field, and formname/fieldname is set as 
appropriate.

Is there a better/easier way to do this?

thanks!

rob.


_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org