• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

form event on group.delete

arie

Member
Hi,

I've a form with a repeatable group. I have added this javascript event

Code:
Fabrik.addEvent('fabrik.form.group.delete', function(a, event))
on form_x.js.

Before removing a group (by clicking on - button), the delete event is fired and I process an ajax request in order to check whether the group can be removed and then I'd like to stop the code by calling
Code:
event.stop()
.

But it doesn't work.

cheers
 
in your js code use the result property to stop the group deletion:

JavaScript:
Fabrik.addEvent('fabrik.form.group.delete', function(form, event) {
    form.result = false;
})
 
OK the issue here was that arie wanted to call an ajax request and stop the group deletion based on the result from the ajax call. As ajax is async this wasn't possible with a simple return. We had to write up some custom js along these lines:

http://pastebin.com/UxXXTWjN
 
Hi,

following this implementation, the logis runs perfectly.
Due to cosmetic purposes, I've decided to alter the default.php form template in order to display differently the addGroup and deleteGroup buttons.

Here are the modification, I've replaced:

Code:
<a class="addGroup" href="#">
 <?php echo FabrikHelperHTML::image('add.png', 'form', $this->tmpl, JText::_('COM_FABRIK_ADD_GROUP'));?>
</a>
by
Code:
<a class="addGroup link-button button-green" href="#" style="font-size:10px;padding: 5% 5% 5% 5%;">
 + Ajouter
</a>

Following that, the code below doesn't run anyore. COuld you please help me???
var delIndex = 0;
group.getElements('.deleteGroup').each(function (b, x) {
if (b.getElement('img') === event.target) {
delIndex = x;
}
}.bind(this));

cheers
 
index.php?option=com_fabrik&view=form&formid=1&rowid=1&Itemid=214
addresses tab
1. delete a group
2. add a group and delete it => this last one should be deletable but it canno't
 
As you no longer have an image in the add button, replace all occurances of :

Code:
if (b.getElement('img') === event.target) {

with

Code:
if (b=== event.target) {
 
I've tried this method but that delete the non deletable group. The issue comes from the fact that the internal id field value isn't retrieve.
Have a look on the console output (first digit is the groupId and the second one is the value of the field internal id).
 
this ones been resolved, had to add an additonal check into the form js code as it was expecting an image
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top