Delete row inside a fich

How to pass a dynamic ID parameter when deleting a table row in ChronoForms.

Overview

The issue occurs because the task button inside a table view incorrectly references the data provider variable instead of the table view's row variable.
In the task button's URL parameters, use the table view name to reference the row data, ensuring the correct ID is passed for deletion.

Answered
Connectivity v6
we webcrea 20 Jun, 2017
Hi,

Think about a stock. I have several quotation.
When open a stock we can see all the quotation in list (view table) about this stock.
And, I would to delete one line

To do that :

- create table_vl
in columns view : delete:{view:vl_delete_link}

- vl_delete_link is a task button
URL and/or URL parameters : vl_id={var:read_fonds_vl.row.fonds_vl.id}
Popup content : {view:vl_delete_confirm}

- vl_delete_confirm is a task button
event : delete
url param : vl_id={var:read_fonds_vl.row.fonds_vl.id}

- delete event
{fn:delete_vl}
{fn:check_delete_vl}

delete_vl is a delete_data
conditions : id:{data:vl_id}

- check_delete_vl is a switch
data provider : {var:delete_vl}

Values setup
true:{success:VL supprimée}
false:{error:Erreur la VL n'a pas été supprimée}

When i click on the trash, it appears the message "Supprimer la VL" and click it, the tr disapears, it's ok but after reload I have the message "Erreur la VL n'a pas été supprimée"
in the network (f12) only parameters of the stock is passed not the vl_id (parameters of the table_vl)

in Réponse

[delete_vl] => Array
(
[_success] => Deletion was successfull.
[log] => Array
(
[0] => DELETE `fonds_vl`.* FROM `arobas17_fcpi_fonds_vl` AS `fonds_vl` WHERE `id` = '';
)

[var] => 0
)


Any idea?

Thanks
Max_admin Max_admin 20 Jun, 2017
Hi Christophe,

When you hover with the mouse over "vl_delete_confirm", what link does it show ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
we webcrea 21 Jun, 2017
Hi Max,

https://www.xxx/accueil-fcpi-fip/tableau-fcpi?conn=liste-fcpi&item_id=941&event=delete

There is not the vl_id to delete and i don't know why...

regards
Max_admin Max_admin 21 Jun, 2017
Hi Christophe,

Maybe because the var is empty, please try the following code in the url parameters of the task button:
vl_id=111

Does the parameter get added to the link ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
we webcrea 21 Jun, 2017
Hello Max

I tried with full url and vl_id= appears but emty

https://www.xxx.fr/arobas2017/accueil-fcpi-fip/tableau-fcpi?conn=liste-fcpi&item_id=941&event=delete&vl_id={var:read_fonds_vl.row.fonds_vl.id}

thanks Max
Max_admin Max_admin 21 Jun, 2017
Hi Christophe,

What url did you try exactly ? did you try to use just "vl_id=111" ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
we webcrea 23 Jun, 2017
Hi Max,

I tried with this url in URL and/or URL parameters

https://www.xxx.fr/arobas2017/accueil-fcpi-fip/tableau-fcpi?conn=liste-fcpi&item_id=941&event=delete_vl&vl_id={var:read_fonds_vl.row.fonds_vl.id}

and the link on the front is
https://www.xxx.fr/arobas2017/accueil-fcpi-fip/tableau-fcpi?conn=liste-fcpi&item_id=941&event=delete_vl&vl_id=

no vl_id informed

thanks
regards
Max_admin Max_admin 23 Jun, 2017
Hi Christophe,

And when you test with a 111 value instead of the {var:read_fonds_vl.row.fonds_vl.id}, does it show the test value ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
we webcrea 24 Jun, 2017
Hi Max,

111 is in url nothing if i use a real vl_id the vl is deleted... The problem is to include in the url the vl_id.

Dynamic Ajax featured checked or not t checked give the same result : no vl_id in the url

I tried in Events to split html

{fn:read_fiche}
{view:html_fiche}
{fn:read_fonds_vl}
{view:html_fiche_vl}
{debug:}

I don't understand, the link in vl_delete_confirm is just with the event=delete_vl and fonds_id
https://www.xxx.fr/arobas2017/accueil-fcpi-fip/tableau-fcpi?conn=liste-fcpi&fonds_id=266&event=delete_vl

I tried to rebuild the button nothing, the url is the same
I tried directly in the first button, the url is the same

I tried throught a function
echo $this->get("read_fonds_vl.row.fonds_vl.id");

it seams to be a bug ?

Regards
Max_admin Max_admin 25 Jun, 2017
Hi Christophe,

Please try this in a view:
{var.pr:read_fonds_vl.row.fonds_vl}


What do you get ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
we webcrea 25 Jun, 2017
Hi Max,

No result the vl is always here

tried
{var.pr:read_fonds_vl.row.fonds_vl}
and
{var.pr:read_fonds_vl.row.fonds_vl.id}

Regards
Chris
Max_admin Max_admin 29 Jun, 2017
Hi Chris,

You mean the results are empty for both codes ? if so then you can also try {var.pr:read_fonds_vl.row} and find the data path.

That code should be called INSIDE the table or inside a view called inside the table.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
we webcrea 29 Jun, 2017
Hi Max,

with {var.pr:read_fonds_vl.row} strange
https://www.xxx.fr/arobas2017/accueil-fcpi-fip/tableau-fcpi?conn=liste-fcpi&fonds_id=941&event=delete_vl&vl_id=%3Cpre+style%3D%22word-wrap%3Abreak-word%3B+white-space%3Apre-wrap%3B%22%3E%3C%2Fpre%3E

in table table_vl
data provider : {var:read_fonds_vl}

columns list
fonds_vl.id:ID
fonds_vl.fonds_date_vl:Date
fonds_vl.fonds_valeur:Valeur
fonds_vl.delete:Delete

columns view
fonds_vl.fonds_date_vl:{date:d/m/Y$(var:table_vl.row.fonds_vl.fonds_date_vl)}
fonds_vl.fonds_valeur
fonds_vl.delete:{view:vl_delete_link}

regards



in debug :

[var] => Array
(
[0] => Array
(
[fonds_vl] => Array
(
[id] => 36
[fonds_id] => 941
[fonds_date_vl] => 2017-06-21
[fonds_valeur] => 125.00
)

)

)
Max_admin Max_admin 30 Jun, 2017
Answer
Hi Christophe,

Well, I missed that earlier, your confirm button is inside the table and you should use the table view name when you reference the "row":
- vl_delete_confirm is a task button
event : delete
url param : vl_id={var:read_fonds_vl.row.fonds_vl.id} <----- WRONG
url param : vl_id={var:table_vl.row.fonds_vl.id} <---- Correct


Best regards,
Max
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.