js alert when deleting an email
authorPierre Habouzit <madcoder@debian.org>
Wed, 3 Sep 2003 14:44:05 +0000 (14:44 +0000)
committerPierre Habouzit <madcoder@debian.org>
Wed, 3 Sep 2003 14:44:05 +0000 (14:44 +0000)
adding an email is a separate <form>, then [enter] adds an email instead of
    deleting one

philter/philter/include/emails.inc.php
philter/philter/philter.js

index dee810f..cac401f 100644 (file)
@@ -97,7 +97,7 @@ class EmailPool {
      * @return  the string containing the form
      */
     function to_form() {
-        $res = "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n"
+        $res = "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\" onsubmit=\"return del_onsubmit()\">\n"
             .  "<table class=\"bicol\" width=\"100%\">\n";
 
         $pair = true;
@@ -114,15 +114,19 @@ class EmailPool {
             .   "    <input type=\"submit\" name=\"emails[apply]\" value=\"Apply changes\" /></td>\n"
             .   "</tr>\n";
 
+        $res .= "</table>\n</form>\n";
+
         $val = 'your email ...';
-        $res .= "<tr><td colspan=\"2\">\n"
+        
+        $res .= "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n"
+            .   "<table class=\"bicol\" width=\"100%\">\n"
+            .   "<tr><td colspan=\"2\">\n"
             .   "   <input type=\"text\" name=\"emails[new]\" size=\"60\" value='$val' "
             .   "onfocus=\"text_onfocus(this,'$val')\" onblur=\"text_onblur(this,'$val')\" />\n"
             .   "   <input type=\"submit\" name=\"emails[add]\" value=\"Add\" /></td>\n"
-            .   "</td></tr>\n";
+            .   "</td></tr>\n"
+            .   "</table>\n</form>\n";
         
-        $res .= "</table>\n</form>\n";
-
         return $res;
     }
 
index e574de5..38852d8 100644 (file)
@@ -29,6 +29,10 @@ function getElement(obj, index) {
     return false;
 }
 
+function del_onsubmit() {
+    return window.confirm("Voulez vous rĂ©ellement supprimer cette adresse mail ?");
+}
+
 /********** ORDER FORM FUNCTIONS **********/
 
 function order_up() {