I've been thinking for a while about the way we can insert JavaScript into our forms. Today we have to insert it at form level. Some JS might be inserted at widget level through the attrs parameter, but it isn't the nicest way for a lot of things.
What I was thinking is "enhancing" the magic and allowing each and every widget to have a "javascript" attribute that would insert the code there (must be a JSLink or JSSource) into the correct place in the form javascript that would then be used on the page. But if it was just that, it wouldn't bring much to what we can achieve today. My second thought was having four magic parameters available to be used replacing placeholders on the code: - widget_id - widget_name - form_id - form_name Those would allow coding things that used the form / widget without going through a convoluted route to obtain these parameters depending on the code being inserted. This would make it easier to insert some "actions" and handle events in our widgets besides making the JavaScript code as portable as the widgets themselves. Rendering a generic widget inside of two, three, ten forms would make it usable without touching the JavaScript code with these variables (and no external javascript code to find that info). Changing the nesting level -- from the form top level to a fieldset inside of that form -- wouldn't require no code changes anywhere (and if you use MochiKit.Signal you wouldn't have to change any of your "listeners" to get the value after the change!). Unfortunately I lack the time and immediate knowledge to implement that, but I thought about sharing this idea to see what you think. I have some JavaScript code to find the form, to let the widget know who it is, etc. that I can share if someone is willing to make our lives easier :-) Is it too crazy? Any of our widgets masters willing to try it? :-) -- Jorge Godoy <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears-trunk -~----------~----~----~----~------~----~------~--~---
