php - Attaching javascript events to form widgets -


I have a form with a drop down menu and whenever I change the selection, I want to perform a JavaScript action. I think it is possible to get input after using Javascript, and attach an event to it; But it seems that it would be easy if there is a special type or option that can be defined in Form-> Configure (): For example

  $ this-> widgetSchema [ Menu '] = new sfWidgetFormChoice (array (...' onclick '=> Javascript function)); Obviously this does not work, and it probably will not be an onclick method, but my question is how do you give JavaScript events in the Input / Widget?  

Every element that creates a Form object, must be a Otogenereted ID, which is usually on : How can I do this by using jQuery as an example:

  $ ('# form_name_field_name'). (Change) 

form_name_field_name

function () {alert ( "with some good stuff '+ this.val ());});


Comments