I have a form with only a submit button in it and I want to display an image in a new pop up window whenever form submit button is clicked in Drupal 7 node.
function custommodule_my_form($form, &$form_state) {
$imgurl = $form_state['build_info']['args'][1];
$form['submit'] = array(
'#value' => 'Print Coupon',
'#type' => 'submit',
);
return $form;
}
The image is present in the loaded node and I already have its URL inside a variable $imgurl.
Now how can add an attribute in this form so that $imgurl opens up in a new window whenever this submit button is clicked.
$form['submit']['#attributes']['onclick'] = ??