Delete warning popup?

grwestby 20 Jan, 2009
Hi Guys,

Is there a way to set the delete link code to cause a popup warning like "Are you sure you want to delete this entry?" I have tried placing this typical popup code in various places in the connections setup but to no avail.
<a href="#delete" onclick="return window.confirm('are you sure you want to delete?');">delete</a>
Any possibilities?

Thanks,
gorg
GreyHead 21 Jan, 2009
Hi gorg,

Try
<a href="#delete" onclick="return confirm('are you sure you want to delete?');">delete</a>

But I don't know if the href is correct.

Bob
grwestby 21 Jan, 2009
Goodmorning Bob,
Thank you for your reply.
I have tried this popup code and it resulted in the same as mine. The Warning pops up perfectly but after selecting OK it goes right back to the original page with out deleting the entry. I am going to try playing with the href some more to see if I can find a way to make it work. Any suggestions are welcome.

Thank you,
gorg
GreyHead 21 Jan, 2009
Hi gorg,

What's the link that ChronoConnectivity uses to trigger a delete? I have no idea.

Bob
GreyHead 21 Jan, 2009
Hi gorg,

That's good, try putting that into the href of your button:
<a href="index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=77 " onclick="return confirm('are you sure you want to delete?');">delete</a>
You'll need to set the cid value by code though.

Is this doing the right kind of thing?

Bob
grwestby 21 Jan, 2009
Bob,
Thank you for your quick turnaround.
I placed this and it works for deleting that one record. The main problem is that now the delete code has the same call next to all of the records.
Closer.
gorg
GreyHead 21 Jan, 2009
Hi gorg,

Yes, you'll need to set the value of cids[] in your PHP somehow.

Bob
grwestby 21 Jan, 2009
HI Bob,
Thank you very much for your time in this. I will continue to work on this in the php and I will post here when I find reasonable answer.
Cheers,
gorg
Max_admin 21 Jan, 2009
Hi gorg,

I think that the problem now is to make the href part of the link dynamic so that you can delete the correct record so don't use the normal ChronoConnectivity delete place holder {delete_record} and instead use Bob's link and change cids variable dynamically.

let me know if this is hard to understand and I will give an example!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
grwestby 21 Jan, 2009
Hi Max,
Thank you for your information.
I understand the location for the edit to be placed but don't have a handle on how to produce the cid variable. I'd love to have a simple example.

Thank you very much,
gorg
Max_admin 21 Jan, 2009
Hi gorg,

the cid comes from the primary key of the table, whats the primary key of this table ? did you create it using Chronoforms ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin 21 Jan, 2009
I just read the other post, u did it using Chronoforms so the primary key will be cf_id and so you can get the cids value using :

<?php echo $row->cf_id; ?>


Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
grwestby 22 Jan, 2009
Hi Max,
This method looks as though it should work perfectly. When hovering over the button it shows the exact same link as when I return to the {delete_record} method. Although when the link is including the
<a href="index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=<?php echo $row->cf_id; ?>" onclick="return confirm('Are you sure you want to delete?');">delete</a>
it logs the user out and leaves the record in contact. Really from my view there is no way that this method shouldn't work.
Any ideas why this would happen.
Thank you for your time,
gorg
GreyHead 22 Jan, 2009
Hi gorg,

That looks OK to me, what shows up in the page html if you do View Source?

Bob
grwestby 22 Jan, 2009
Hi Bob,
The HTML source code is
<a onclick="return confirm('Are you sure you want to delete?');" href="/index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=105">delete</a>
and yields the link http://mysite.com/index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=105. These are the results in the browser when I have added
<a href="index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=<?php echo $row->cf_id; ?>" onclick="return confirm('Are you sure you want to delete?');">delete</a>
to the body in the connection settings.

this is still randomly logging the user out and not deleting the record.

More often it redirects me to http://www.mysite.com/index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=105 and states "You are not authorized to view this page "

I am lost

I will point out that the link returned by the {delete_record} this is the HTML source code
<a href="/index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=105">
.

Thanks for continuing on this,
gorg
Max_admin 22 Jan, 2009
Hi gorg,

may be there is some permission issue, what permission did you set for the delete ? I think the core code will need to be hacked because the permissions are set automatically by CConnectivity depending on the existence of the {delete_record} link!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
grwestby 22 Jan, 2009
Hi Max,

Thank you for your efforts.
I will dive into the core code and see what I can find for the {delete_record}. I have checked the permissions and the delete record permissions are set correctly. Meantime I am researching a php method to be added to the body of the connection. I'll tell you how it goes.

cheers,
gorg
porgigi 17 Jun, 2010
You must add the following code in the Delete Link Code:

<img src = "images/cancel_f2.png" border = "0" title = "Delete Record" style = "width: 20px;" onclick = "return confirm ('Are you sure you want to delete ?');"/ >


worked great
tpersson 21 Jan, 2011
Hi!
This is not a final solution, but if you put </p> in the delete_record html and use {delete_record} in the body html, the links popup work perfectly.
buckrobbie80 19 Feb, 2011
I am a newbie to code could someone please post a complete solution to this problem I combined the code from Re: Delete warning popup? by grwestby » Thu Jan 22, 2009 12:21 am
<a href="index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=<?php echo $row->cf_id; ?>" onclick="return confirm('Are you sure you want to delete?');">delete</a>

and
Re: Delete warning popup? by porgigi » Thu Jun 17, 2010 12:50 pm
You must add the following code in the Delete Link Code:
<img src = "images/cancel_f2.png" border = "0" title = "Delete Record" style = "width: 20px;" onclick = "return confirm ('Are you sure you want to delete ?');"/ >

and came up with
{edit_record}
<br />
<br />
{delete_record}
<a href="index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=<?php echo $row->cf_id; ?>" <img src = "images/cancel_f2.png" border = "0" title = "Delete Record" style = "width: 20px;" onclick = "return confirm ('Are you sure you want to delete ?');"/ >
<br />
<br />
<div>{text_1}</div>
<br />
<br />

If I click on delete record it immediately deletes it but it strangely allows me to also click on a name from a name field that is returned with {text_1} if I click on the name it asks me to confirm delete but it doesn't delete it says: there is no connection with this name.
Would someone please list a workable solution all in one post including where and what file or module the code goes in. I am sorry for bothering you but I got lost jumping around in all of the replys to this post.

Thank's again,
Robert
Gingo 19 Aug, 2011
hi,
i want a delete confirmation pop us window with the message "are sure to delete?" and with ok and cancel buttons, the ok button will take the user to the "del.php" and the cancesl button will simply close the popus window, can any one please wirte the complete javascript code as well any code if needed in the body of that html page? thanks in advanced for your help.
Francol 23 Aug, 2011
Try this one.
<script language="javascript" type="text/javascript" >
function confirmdelete() {
var confirm = document.getElementById("confirm");
confirm.value = window.confirm("Are you sure you want to delete?");
return confirm.value;
}
</script>

<form enctype="multipart/form-data" action="delPicture.php" method="post" onsubmit="return confirmdelete();">
<div id="Triggered"><b>delete by Id</b></div>
<input type="hidden" name="confirm" id="confirm" value="false">
<input name="recordId" type="text" value="" /><br>
<input type="submit" value="delete"/>
</form>
SAGO 17 Mar, 2012

Hi Bob,
The HTML source code is

<a onclick="return confirm('Are you sure you want to delete?');" href="/index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=105">delete</a>
and yields the link http://mysite.com/index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=105. These are the results in the browser when I have added
<a href="index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=<?php echo $row->cf_id; ?>" onclick="return confirm('Are you sure you want to delete?');">delete</a>
to the body in the connection settings.

this is still randomly logging the user out and not deleting the record.

More often it redirects me to http://www.mysite.com/index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=105 and states "You are not authorized to view this page "

I am lost

I will point out that the link returned by the {delete_record} this is the HTML source code
<a href="/index.php?option=com_chronoconnectivity&connectionname=MealLog&task=deleterecord&cids=105">
.

Thanks for continuing on this,
gorg




Hi,

I had the same problem when trying to use a manual link instead of {delete_record} and like you I always get: "You are not authorized to view this page"

But I solved it by putting the {delete_record} in a div and hide it.
<div style="display:none">{delete_record}</div>


I'm using a trash-can image as a button/link.
So here is the complete code:

<td><a href="http://www.site.com/index.php?option=com_chronoconnectivity&connectionname=my_form&task=deleterecord&cids={cf_id}"><img src="http://www.site.com/images/stories/delete_record.jpg" onclick = "return confirm ('Are you sure you want to delete this record?');" /></a> <div style="visibility:hidden">{delete_record}</div></td>


I would have thought that the "FrontEnd Settings" would make a connection based on the settings and not whether {delete_record} is available or not.

Anyways, hope this helps someone in the future.

Cheers,

Sago
This topic is locked and no more replies can be posted.