I need to use javascript validation for the form i have created. How to use javascript validation for this?

Comments

mm167’s picture

1. write the script
2. put it in drupal
3. save

done.

kovalev’s picture

I assume that you know how to write the script, and your problem is to integrate it into Drupal.
So, If it is in a standalone .js file, you can:
1) (Not good/pretty) add to your page-???.tpl.php, in head section:

2) From almost anywhere (module/template ...) write: drupal_add_js("PATH/YOURFILENAME.js");
See explanation here: http://api.drupal.org/api/function/drupal_add_js/6
If the script is not a standalone file, again as in (2) use:
drupal_add_js("YOUR SCRIPT WITHOUT SCRIPT TAGS HERE","inline");

------------------------------------------------------------------------------------------------------------------------------------
Sergata - פיתוח תוכנה