From 4c823d351d8d1db826fdd1343f10de0f99db8b94 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 9 Mar 2015 00:04:59 -0400 Subject: [PATCH] Closes #150 disable and uncheck "send email" if email field is empty --- admin/new_ticket.php | 7 ++++--- js/modsForHesk-javascript.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/admin/new_ticket.php b/admin/new_ticket.php index 2dab4e2f..790e69cf 100644 --- a/admin/new_ticket.php +++ b/admin/new_ticket.php @@ -186,10 +186,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
- - placeholder=""> + placeholder="" + onkeyup="disableIfEmpty('email-input','notify-email')">
@@ -942,7 +943,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
-
+


diff --git a/js/modsForHesk-javascript.js b/js/modsForHesk-javascript.js index cc98d8e9..9fb5597d 100644 --- a/js/modsForHesk-javascript.js +++ b/js/modsForHesk-javascript.js @@ -68,4 +68,15 @@ function toggleContainers(showIds, hideIds) { }); } +function disableIfEmpty(sourceId, destinationId) { + if ($('#' + sourceId).val().length > 0) { + $('#' + destinationId).attr('disabled', false); + } else { + if ($('#' + destinationId).is(':checkbox')) { + $('#' + destinationId).attr('checked', false); + } + $('#' + destinationId).attr('disabled', true); + } +} + jQuery(document).ready(loadJquery);