#7124: Form field javascript event handler
---------------------------------------------+------------------------------
          Reporter:  MihaiD                  |         Owner:  nobody
            Status:  closed                  |     Milestone:        
         Component:  Forms                   |       Version:  SVN   
        Resolution:  wontfix                 |      Keywords:        
             Stage:  Design decision needed  |     Has_patch:  0     
        Needs_docs:  0                       |   Needs_tests:  0     
Needs_better_patch:  0                       |  
---------------------------------------------+------------------------------
Comment (by lukeplant):

 My example should have been {{{$("#id_email")}}} of course, which I'm sure
 jQuery will optimise into a simple {{{document.getElementById()}}} without
 doing any DOM traversal.  Or you can do this yourself, without the jQuery
 dependence. Either way, I'm sure it can't take 5 sec no matter the size of
 the document.  If you want designers to be able to do this by just editing
 templates, your options are:

  * Use the above method of adding event handlers using
 {{{document.getElementById()}}} (or some wrapper, like jQuery).
  * Don't use Django to render the entire form -- render it field by field
 in the template, overriding with custom HTML as necessary.
  * Some complex template tag that allows you to add "onchange" handlers to
 a form field from within the template.  This would likely be very messy,
 and not actually designer friendly.

 This discussion is straying from the feature request first given in the
 bug, of course -- adding event handler attributes in Python code is
 already supported by {{{attrs}}}, and won't help your use case.  If you
 have a more concrete suggestion about how to better support adding event
 handlers in the template, it would be best to open another ticket.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7124#comment:6>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to