javascript for Form Element

sisyphus - November 21, 2008 - 05:15

i would like to put some javascript (e.g. onClick=functionName()) for some form elements, say button and checkbox. where should i put the script?

thanks a lot.

Use the theme_hooks in

New Zeal - November 21, 2008 - 09:26

Use the theme_hooks in form.inc. For instance open up form.inc and you will find a function theme_select and another theme_radio (Drupal 5). Identify the correct elements that you want to add the javascript to, copy the whole function from form.inc to your template.php theme file rename to phptemplate_select and phptemplate_radio. Then add in the bits that you want. You will need to understand a bit about the code in the function to acheive this.

Passing Phase Web Development

 
 

Drupal is a registered trademark of Dries Buytaert.