Delete data action fails

How to fix a ChronoForms delete data action that fails.

Overview

The issue occurs because the WHERE clause conditions for the delete action are not properly defined, often due to the article ID not being captured in Joomla 4.
Add a PHP action before the delete to capture the ID, then use that variable in the delete action's WHERE conditions.

Answered
ChronoForms v7
kg kgriffin 18 Aug, 2021
I recreated the Article list demo delete action in my own form and got the below debug. I then tried the delete data action in the Article list demo and that also failed. I think this may be a bug?
Array
(
    [chronoform] => currscholapp_committee
    [gpage] => DeleteApp
    [aid] => 574
    [Itemid] => 491
    [option] => com_chronoforms7
    [view] => form
)
Array
(
    [delete_data_569] => Array
        (
            [result] => Data deletion failed!
            [log] => Array
                (
                )

            [var] => false
        )

)
ma mac1976 09 Dec, 2022
Maybe it's not allowed to delete data entries from outside? Does anyone know how to solve this?
TG TGeier 12 May, 2023
Too bad you haven't found a solution yet. I am facing the same problem.
Max_admin Max_admin 12 May, 2023
what did you pass in the Delete Data action "Conditions" ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
vd vdneut 16 May, 2023
I have the same problem with that part of the demo.
It looks like the WHERE clause is not defined, aka 'conditions' (thanks Max).

In the Delete Data action 'Delete Article', I added the 'Where Conditions' option in Advanced Settings and added the following where condition:
Table field name: Article.id
Operator: =
Value: {data:id}

The {data:id} refers to the URL parameter '&id=123 (article id)

Don't know if there is a better way, or if it is an omission in the demo; I let Max be the judge of that ;-)
Max_admin Max_admin 17 May, 2023
Answer
This is a known issue in J4, the article id is not captured in CF, you will need to add a PHP action before the delete:

$this->set("id", JFactory::getApplication()->input->getInt('id'));

then in the Delete Action you should use {var:id} instead of {data:id}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.