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.

Comments

NewZeal’s picture

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