By dragon2000 on
Hi,
I want to add a button to the content edit section using hook_form_alter and run a js function(openFileBrowser) to open the IMCE.
function openFileBrowser() {
window.open('/?q=imce&app=myApp|url@urlField', '', 'width=760,height=560,resizable=1');
}
Is the following method right? (It doesn't work), what is the solution?
$form['new']['button'] = array(
'#type' => 'button',
'#value' => 'Browse',
'#onclick'=>'openFileBrowser()',
or '#submit' =>'openFileBrowser()',
);
thanks in advance ...
Comments
I used drupal_add_js to
I used drupal_add_js to implement the function but it still doesn't work:
please help me...
Try this
great
Great buddy,
it works nice..
Thanks.
Drupal Approach
Drupal Approach
$form['new']['submit'] = array(
'#type' => 'submit',
'#value' => 'Browse',
'#attribute'=>array("onClick"=>"openFileBrowser()")
);