[html-formfu] how to handle onFocus event in yml file

Tobias Kremer list at funkreich.de
Tue Jun 26 20:25:33 GMT 2007


Am 26.06.2007 um 21:09 schrieb kewei xiao:
>    I created a javascript function "setFocus()" to handle onFocus  
> event in my form, but I am not sure how this function gets called  
> in yml file.  Should I include it under "attrs"?  Please advise.

I tend to add event-handlers unobtrusively via jQuery which allows  
something like this:

$(document).ready( function(){
   $("input#username").focus( setFocus() );
});

Other than that, the HTML::FormFu manpage suggests (YAML):

elements:
   - type: text
     attributes_xml: { onchange: $javascript }

HTH,

--Tobias





More information about the HTML-FormFu mailing list