Hello.

I have a page that lists records and each row has a link that goes to a 
page which deletes the associated record.

But before the browser navigates to that page I stop it by asking the user 
if they really want to delete the item.

If they click cancel the browser goes nowhere.
If they click OK the browser navigates to the php file that deletes the 
record.

My problem is that after the confirm() UI appears and is clicked, it 
appears AGAIN, then when I click again does the expected behaviour occur.

What is causing that in this code?

document.observe("dom:loaded", function() {
  // attach to all delete links in the table
  var dels = $$('td a.delete');
  dels.each(function(s){
    s.observe('click', function(event){ confirmDelete(event); }  );
  } )
});


function confirmDelete(event)
{
    var ask = confirm('Are you sure you want to delete this entry?');
    
    if(ask){ xfoo = 'follow link - delete it'; }
    else{ event.stop();  xfoo =' do nothing - stop event ';      }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/qwdMPG_i8WMJ.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to