Announcement

Collapse
No announcement yet.

Second Level of Confirmation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Second Level of Confirmation

    I am trying to add in a second level of confirmation when deleting files. The code is here:

    Code:
    for (i = 0; i < files.length; i++)
    {
    r += "<tr>";
    r += "<td>&nbsp;&nbsp;&nbsp;<img src=\"/config/file.gif\" />&nbsp;&nbsp;<a href=\"javascript:void(0)\" onclick=\"if (confirm('Are you SURE you want to delete the file " + files[i][0] + "?')) ajax_FsBrowseClean([true, 'dir=" + encodeURIComponent(cwd) + "&amp;path=";
    r += (root) ? encodeURIComponent(cwd + files[i][0]) : encodeURIComponent(cwd + '/' + files[i][0]);
    r += "&amp;action=deletefile']); return false;\"><img src=\"/config/remove.gif\" /></a></td>";
    r += "<td><a href=\"/fs?file=";
    r += (root) ? encodeURIComponent(cwd + files[i][0]) : encodeURIComponent(cwd + '/' + files[i][0]);
    r += "\" target=\"_blank\">" + files[i][0] + "</a></td><td>" + files[i][1] + "</td>";
    r += "</tr>";
    }
    In other words, fiirst, the device is supposed to ask, "Are you sure?" Second, it is supposed to say, "Confirm deletion of <filename>?"

    Can somebody help me here?

    Thanks,

  • #2
    This was achieved by adding an "and operation":
    Code:
    onclick=\"if (confirm('first confirmation') && confirm('Are you SURE you want to delete the file "

    Comment

    Working...
    X