Solved using JQuery, No need to put the event in the <input ...>.
Can bind the event externally:

index.html
 <SCRIPT>
 function on_field_changed(){
     //....
 }
 $(document).ready(function() {
     $("#form_field").blur( function(){on_field_changed()});
 });
 </SCRIPT>

I used blur and not change, because I had a problem with firefox 15.0.1. 
Firefox was expecting a lost focus event, while with chrome opera safari 
also the event $("#form_field").change was accepted. 



On Monday, October 8, 2012 6:29:28 PM UTC+9, alex wrote:
>
> I have this custom form:
>
>  {{=form.create_form.custom.begin}}
>       {{=*form.create_form.custom.widget.field*}}
>       {{=form.create_form.custom.submit}}
>  {{=form.create_form.custom.end}}
>
>
> how do I attach an event "onclick" to the widget 'field", to obtain this?
>
> <input onclick="foo()" id="form_field" name="field" type="text" value="" />
>
>

-- 



Reply via email to