Commit 2b27a5c4 authored by Amit Asaravala's avatar Amit Asaravala
Browse files

by aasarava: added javascript block to prevent accidental double-click of...

by aasarava: added javascript block to prevent accidental double-click of confirmation button; fixed array error when no taxonomy terms are defined.
parent 10affe6b
......@@ -380,7 +380,7 @@ function scanner_form_submit($form_id, $form_values) {
$_SESSION['scanner_wholeword'] = $form_values['wholeword'];
$_SESSION['scanner_published'] = $form_values['published'];
$_SESSION['scanner_regex'] = $form_values['regex'];
$_SESSION['scanner_terms'] = array_filter($form_values['terms']);
$_SESSION['scanner_terms'] = $form_values['terms'];
$_SESSION['scanner_replace'] = $form_values['replace'];
if ($form_values['op'] == 'Replace') {
......@@ -399,6 +399,39 @@ function scanner_form_submit($form_id, $form_values) {
* replacing things they don't intend to.
function scanner_confirm_form() {
//using set_html_head because it seems unecessary to load a separate css
// file for just one declaration:
//you can override the styles by declaring with something "higher up"
// the chain, like: #wrapper #scanner-confirm-form .scanner-buttons .scanner-button-msg {...}
<style type="text/css">
#scanner-confirm-form .scanner-buttons .scanner-button-msg {
top:0; left:0; z-index:100;
width:100%; height:100%;
background-color:#000; opacity:0.75;
#scanner-confirm-form .scanner-buttons .scanner-button-msg p {
//javascript to prevent further clicks on confirmation button after it's clicked once.
//unfortunately we can't just use css disable to disable the button because then
// the op values aren't sent to drupal correctly.
$(document).ready(function() {
$('input[@type=submit][@value=Yes, Continue]').click(function() {
.append('<div class=\"scanner-button-msg\"><p>Replacing items... please wait...</p></div>')
$('.scanner-button-msg').click(function() { return false; });
return true;
", 'inline');
$form = array();
$search = $_SESSION['scanner_search'];
......@@ -467,10 +500,12 @@ function scanner_confirm_form() {
$form['confirm'] = array(
'#type' => 'submit',
'#value' => t('Yes, Continue'),
'#prefix' => '<div class="scanner-buttons">', //see suffix in cancel button element
$form['cancel'] = array(
'#type' => 'submit',
'#value' => t('No, Cancel'),
'#suffix' => '</div>', //see prefix in confirm button element
return $form;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment