From 5d2556da435bec11cff7d5ba73f6f0e4447f8668 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 26 Mar 2014 15:12:26 -0500
Subject: [PATCH] forms: Allow field data delete when field is dropped

---
 include/staff/dynamic-form.inc.php | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/include/staff/dynamic-form.inc.php b/include/staff/dynamic-form.inc.php
index a565e1be5..0325331fe 100644
--- a/include/staff/dynamic-form.inc.php
+++ b/include/staff/dynamic-form.inc.php
@@ -223,11 +223,36 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
         </tr>
     </tbody>
     </table>
-<p class="centered">
+<p class="centered" id="actions">
     <input type="submit" name="submit" value="<?php echo $submit_text; ?>">
     <input type="reset"  name="reset"  value="Reset">
     <input type="button" name="cancel" value="Cancel" onclick='window.location.href="?"'>
 </p>
+
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3><i class="icon-trash"></i> Delete Existing Data?</h3>
+    <a class="close" href=""><i class="icon-remove-circle"></i></a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="submit-confirm">
+        Would you also like to remove data currently entered for this field?
+        <em>If you say no, you will have the option to delete the the data when editing it</em>
+        <br><br>Deleted data CANNOT be recovered.
+        <hr>
+        <input type="checkbox" name="delete-data" />
+        Remove all data entered for this field
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Save Changes!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
 </form>
 
 <div style="display:none;" class="dialog draggable" id="field-config">
-- 
GitLab