Ajax deletion

tali

Member
Hi,
For some reasons I'd like to send an ajax request to delete row of id rowid.
Something as what does the delete button on a row in a list.
The URL under the button just gives /#

Can this be done by a request like
Code:
?option:com_fabrik&ids[3025]:3025&listid:17&listref:19_com_fabrik_19&Itemid:282&fabrik_referrer:842b3c52d936b4e1c8abd3c0d480fa6c:1&format:h&ml&packageId:0&task:list.delete&incfilters:1

Is there a simple way to have something like
Code:
        $model = JModelLegacy::getInstance('list', 'FabrikFEModel');
        $model->setId(le n? de la liste);
        $model->deleteRows($ids);
running on the server?
 
Where are you trying to run this code from?

But yes, pretty much that exact code is what you need, and the $ids just needs to be an array of row ids.

-- hugh
 
Thank you for your reply.

I'm trying to run this code form a list BUT this list is embedded inside a form and ajax loaded.
In that case, it appears that by default, the X button is not working.

I found an ajax solution to have the edit button working, but did not find a working solution for the delete button.
 
By "embedded" you mean with the content plugin in the form intro/outro?

Sent from my HTC 10 using Tapatalk
 
In fact, as I have several lists, the ajax call for each one is in a display element, one per list.
 
Ah. Hmmm, no, that won't work.

I mean, it may kind of half-assed seem to work, but is liable to cause lots of problems, because lists have HTML forms in them (which handle all the filtering, checkbox selections, action buttons and navigation), as do forms (surprise surprise). And HTML doesn't let you nest form tags. And if you do nest forms, HTML gets very confused about what form inputs belong to which form, and what you are trying to submit. Which is why your delete and edit buttons don't work.

The only place it's safe to "embed" a list on a form is in the intro or the outro, where it is outside the form tags for the Fabrik form.

If you are only displaying this in a details view, it'll work, as details views don't have form tags, they are just divs.

I'm very reluctant to help you find ways to work round this, as you are liable to run into more unexpected issues, and there really is no way of safely working round a fundamental limitation of HTML forms.

This is one of the reasons we developed our AJAX driven popup windows for displaying lists and forms, as it's a way of accessing another form or list from within a form or list, without leaving that page, but working round the "can't nest HTML forms" issue.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top