drupal-6


calling of javascript function on button click in .module file in drupal


I have one button and onclick i want javascript function to be called which contains alert message...............in drupal
i tried many things like...........
1)i created button using
$form['click'] = array(
'#type' => 'button',
'#attributes' => array('onclick' =>_____________),//dnt know what to give for onclick
'#value' => t('click'),
);
2)used drupal_add_js(drupal_get_path('module', 'document').'/eg.js', 'module');in hook_form_alter()
3).js file is as follows
function message()
{
alert("Catch ->This alert box was called");
} -->
want alert message to be displayed on button click.
Kindly help................
Thanks in advance
$form['search_something'] = array(
'#type' => 'button',
'#value' => t('Search'),
'#attributes' => array('onclick' => 'searchsomething()),
);
this is the piece of code to call javascript on button click.
Javascript function
function searchsomething(){
alert("hello");
}

Related Links

password reset link not working in drupal 6
Theme_image() returns nothing
Issues in node template naming in drupal 6
Sort Content in drupal 6 views using date and time seperate fields
Issues with custom queries in views
Lot of spams on drupal 6 site with reCaptcha module [closed]
get data from just created node and pass it to url
how to a translatable string in drupal theme?
How to create node of particular content type from webform results?
Need to export drupal comments to disqus
How to add js file in footer in drupal6?
how to include jwplayer in drupal site
Is it possible to combine two hook_preprocess functions into one in drupal 6
How to access cck fields in tpl file?
drupal 6 authenticated user
Show drupal node along with comments for iphone app

Categories

HOME
layout
sd-card
razor
amortized-analysis
electronics
twitter-bootstrap-4
jgroups
installshield
podio
adfs
facebook-messenger-bot
here-api
quickbooks
orchardcms
flask-wtforms
progressive-web-apps
alpine
lldb
jtextfield
nas
cx-freeze
autoconf
mmap
facet
web-api-testing
spring-mybatis
minitab
file-rename
microsoft-chart-controls
phonegap
gtrendsr
code-contracts
wallpaper
html5-fullscreen
vxworks
swift3.0.2
sas-visual-analytics
jvm-languages
nand2tetris
turbogears
bootstrap-dialog
outlook-2013
prolog-setof
rails-routing
sage-one
domain-model
pebble-watch
recursive-datastructures
carrot
worker-thread
crypt
redundancy
query-performance
quartz-composer
gnome-shell-extensions
eventkit
messenger
root-framework
cubes
infix-notation
slicknav
fody
disque
pickadate
itextpdf
associative-array
energy
phpcas
browser-link
tcpserver
maven-tomcat-plugin
reactive-banana
thredds
emailrelay
map-projections
operation
processmodel
npapi
xc16
cdt
applescript-objc
c18
coverflow
dataadapter
factory-method
first-responder
word-processor
labwindows
tridion-worldserver
objective-c-2.0
qtkit
nsmanagedobject
netbeans-6.9
postgresql-performance
eclipse-templates
gcj
blackberry-playbook
horizontal-accordion
blitz++
dmx512
gin
nhibernate.search
sustainable-pace

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App