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

how to enter words in synonyms.txt file of apache solr search
How to disable/hide the submit function when the form is submitted?
Heirarchical Select Steps Drupal 6
Making views custom field sortable in Drupal on a table view?
Drupal6 - product comparison
drupal 6 multitab with ajax content
How to place a cck field inside a fieldset?
How to display the maxlength countdown remaining characters for custom form fields
How to put the field label inside the form select field?
Symbol “?” in alias or Dirty url
hook_comment not modifying data
How to use php session in drupal 6
Drupal 6, Create a form in a node which save data to another content type (cck)
Synchronize language switcher with language from user profile
How to replace fckeditor with CKeditor?
rel=nofollow does not add to the links in my CCK field

Categories

HOME
google-chrome-extension
path-finding
sd-card
google-docs
electronics
ip
pivotal-cloud-foundry
virtualization
applepay
dacpac
row
windows-azure-storage
alignment
openrefine
pc
windows-7-x64
http-status-code-504
connection-string
viewport
karma-jasmine
jtextfield
custom-wordpress-pages
visjs
vlsi
social-media
jaxb2
windows-server-2000
libuv
primitive
r-raster
typed.js
webtest
hexo
wpf-controls
multilingual
service-discovery
c11
preconditions
ruby-on-rails-3.1
chain-builder
paxos
nativeapplication
tactic
cudafy.net
removechild
android-textview
sts-springsourcetoolsuite
contact-list
angstrom-linux
markojs
rgeo
appfabric-cache
createprocessasuser
dundas
lustre
jscript.net
onactivityresult
openexr
ceil
hippomocks
hyprlinkr
message-driven-bean
odata4j
opcache
flash-builder4.5
excel-2003
django-nonrel
orchardcms-1.7
html-editor
libstdc++
nsnetservice
runas
frameset
automount
enter
window-management
gnustep
blackberry-playbook
sql-server-profiler
mysql-error-1005
datareader
radcombobox
paster
routedevent
web-architecture
libs
zend-decorators
signal-handling
ntvdm.exe

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App