Index: openacs-4/packages/acs-templating/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/form-procs.tcl,v diff -u -r1.46.2.8 -r1.46.2.9 --- openacs-4/packages/acs-templating/tcl/form-procs.tcl 3 Oct 2016 18:52:07 -0000 1.46.2.8 +++ openacs-4/packages/acs-templating/tcl/form-procs.tcl 8 Nov 2016 10:34:55 -0000 1.46.2.9 @@ -587,9 +587,26 @@ append output " class=\"margin-form\"" } + # make sure, that event handlers have IDs + foreach name [array names attributes] { + if {[regexp -nocase {^on(.*)%} $name . event]} { + if {![info exists attributes(id)]} { + set attributes(id) "id[clock clicks -microseconds]" + } + } + } + # append attributes to form tag foreach name [array names attributes] { - if {$attributes($name) eq {}} { + if {[regexp -nocase {^on(.*)%} $name . event]} { + # + # Convert automatically on$event attribute into event listener + # + template::add_event_listener \ + -event $event + -id $attributes(id) \ + -script $attributes($name) + } elseif {$attributes($name) eq {}} { append output " $name" } else { append output " $name=\"$attributes($name)\""