Hi
I have one grid that i made myself. I need to confirm the delete option, maybe wuth Javascript. Any help, please?
Thank you
Confirm delete
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Confirm delete
Put the Yes/No for the delete in a hidden div that is shown when they click the Delete link.
(#10850)
- SimpleManWeb
- Forum Commoner
- Posts: 57
- Joined: Wed Dec 30, 2009 4:15 pm
- Location: New Hampshire, USA
Re: Confirm delete
here is the simple javascript that you can either attach to the 'onsubmit' form, this is assuming you are using a button to process the delete action.
I didn't test that code, but that should work.
Hope this helps.
Code: Select all
return confirm('Are you sure you want to delete this?');
Hope this helps.
-
mariolopes
- Forum Contributor
- Posts: 102
- Joined: Sun May 22, 2005 7:08 am
Re: Confirm delete
Hum...
I don't have any form I only have a link to a php file who deletes the record. Please look at the following code;
echo "<td>"; echo "<a href='Apagar.php?Id=";echo $row[Id];echo "'>Delete</a>";echo "</td>";
I have to use one form?
Thank you
I don't have any form I only have a link to a php file who deletes the record. Please look at the following code;
echo "<td>"; echo "<a href='Apagar.php?Id=";echo $row[Id];echo "'>Delete</a>";echo "</td>";
I have to use one form?
Thank you
Re: Confirm delete
Just use <a onclick=""> instead of onsubmit="". I have not tested it but i think it would work. The hidden div would work best for this in my opinion.
- SimpleManWeb
- Forum Commoner
- Posts: 57
- Joined: Wed Dec 30, 2009 4:15 pm
- Location: New Hampshire, USA
Re: Confirm delete
lshaw is correct. The onclick will work just fine. Use something like this
What this does is cancels out the click if the person doesn't confirm the question. Again, this is untested but it should get you very close.
Code: Select all
echo "<td>";
echo "<a href='Apagar.php?Id=";
echo $row[Id];
echo "' onclick='return confirm(\"Are You Sure you want to delete this?\");'>Delete</a>";
echo "</td>";
-
mariolopes
- Forum Contributor
- Posts: 102
- Joined: Sun May 22, 2005 7:08 am
Re: Confirm delete
Works fine guys, solved my problem
Thank you
Thank you