confirm delete action

tvdgreft 29 Feb, 2016
In the column lists I added a delete action:
_DELETE_:delete

When a user clicks on "delete" the corresponding record is deleted directly.
Is it possible to add a delete confirmation to prevent mistakes?
GreyHead 01 Mar, 2016
Hi tvdgreft,

You could possibly add a JavaScript alert on the button? Or possibly use a custom delete link that calls a form event where you can add the check (and maybe change the record status rather than delete so that changes can be reversed if necessary.)

Bob
tvdgreft 01 Mar, 2016
Hi Bob,

I prefer your solution of the custom link, but I don't know how to do that.
The columns list ends now with: _EDIT_:wijzig and in the action tab I have added the form event "inschrijving_edit:load" in order to modify a record.
I want also to add a link in the Colums list to link to a form "inschrijving_delete", which asks for confirmation. I cannot find out what to do for that.

Theo
GreyHead 01 Mar, 2016
Hi tvdgreft,

I think that you can add a link using the HTML box something like this
model_id.delete:[ <a href='/index.php?option=com_chronoforms5&chronoform=form_name&event=del&cf_id={model_id,id}' >Delete</a> ]

Bob
tvdgreft 01 Mar, 2016
Thank you Bob, now I understand better how to make a link. But......

I have made a new action called "remove" with a form event "inschrijving_remove:load"

In the HTML box I made this link:
inschrijving.remove:<a href="index.php/inschrijvingen-ccv5?cont=lists&ccname=inschrijvingen&act=remove&gcb={inschrijving.id}">delete</a>

The form "inschrijving_remove" is started well, but the form data is not available. (like in the edit action)
When I start a form from the edit action , in that form all fields are available in $form->data and that is what I like to see using action "remove"

Is that possible?
GreyHead 02 Mar, 2016
Hi tvdgreft,

Is the record id in the URL correctly? Then you can use that in a DB Read action to read the record.

Bob
tvdgreft 02 Mar, 2016
Hi Bob,

Yes that is a good possibility. But I was thinking if it is possible to pass the form data (like with the edit action) to the chhronoforms form and in the form ask for confirmation and then start the connection action delete to delete the record by chronoconnectivity
GreyHead 02 Mar, 2016
Hi tvdgreft,

I think that it's doing the same thing. In your form use the On Load event to show some form data for confirmation and change the Submit button to 'Confirm delete' (maybe add a cancel button to that goes back to CC) then in the form On Submit event do the deletion.

You can probably do all of this in a modal window with Ajax submission if you like.

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