|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Help - need to fix javascript delete checker via href
Hi All,
I'd be so grateful if someone could have a quick look at this for me... basically I have a js function called confirm_delete. It does the usual stuff via forms like 'do you really wanna delete this', etc. It works for me via forms but I'm trying to do the same thing via a href tag and it gives the error message but doesn't move onto the next page... any ideas... code below? I'm sure it's something simple regarding the js function but I'm not au fait with javascript at all so any advice would be a big help. Thanks in advance, sorry about the php... in a massive rush. function confirm_delete(ObjectDescription, FormName) { ObjectDescription = unescape(ObjectDescription) alert('You are about to permanently delete "' + ObjectDescription + '"') if (confirm('Are you sure?')) { self.document.forms[FormName].submit() } else { self.document.forms[FormName].reset() } } HERE'S MY HREF VERSION (NOT WORKING) $FormName = "edit1.php?TheIDForDelete=".$TheID; $Arguments = "\"".$StoryHeaderValidate."\",\"".$FormName."\""; $LISTOFSTORIES .= "<a href=javascript:confirm_delete(".$Arguments.") value=\"Delete\" class='SmallLink'>\n"; BUT VIA FORM IT WORKS PERFECTLY... print "<td>\n\n<form action=\"blah.php\" method=\"POST\" name=\"delete_$message_id\">\n"; print "<input type=\"hidden\" name=\"action\" value=\"delete_email\">\n"; print "<input type=\"hidden\" name=\"emailtodelete\" value=\"$message_id\">\n"; $subject = rawurlencode($subject); // need to do this else the JS will complain about quotes print "<input type=\"button\" value=\"Delete\" onClick=\"confirm_delete('$subject', 'delete_$message_id')\">\n"; //print "<input type=\"submit\" value=\"Delete\" >\n"; print "</form>\n\n </td>\n"; |
|
#2
|
||||
|
||||
|
confirm delete in anchor tag
Ths may be more of a PHP problem. Try inserting echo-s to check the var values. eg.:
$Arguments = "\"".$StoryHeaderValidate."\",\"".$FormName."\""; echo "Arguments: " . $Arguments; $LISTOFSTORIES .= "<a href=javascript:confirm_delete(".$Arguments.") value=\"Delete\" class='SmallLink'>\n"; Last edited by Mittineague : July 28th, 2005 at 09:33 AM. Reason: the way to solve the problem |
|
#3
|
||||
|
||||
|
If possible, provide us with the HTML after it's been rendered by the PHP engine.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Help - need to fix javascript delete checker via href |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|