I made a file; form_1.js. I tried the JS file to include a simple pop up box at first.
So I guess that works.
But with the below script in the form_1.js file I get the following error: ReferenceError: Fabrik is not defined on the bold rule
I work with Fabrik 3.3.4 (most newest one)
(I got the error with firebug)
_____________________________________
var formRef = 'form_1';
// The group you wish to repeat's ID
var groupId = 2;
// The number of times to repeat
var repeatNum = 3;
var form = Fabrik.blocks[formRef];
// Get the repeat group button
var btn = form.getElement('#group' + groupId + ' .addGroup');
if (typeOf(btn) !== 'null') {
// Create mock event
var e = new Event.Mock(btn, 'click');
// Duplicate group
for (var i = 1; i < repeatNum ; i ++) {
form.duplicateGroup(e);
}
}
_____________________________________
So I guess that works.
But with the below script in the form_1.js file I get the following error: ReferenceError: Fabrik is not defined on the bold rule
I work with Fabrik 3.3.4 (most newest one)
(I got the error with firebug)
_____________________________________
var formRef = 'form_1';
// The group you wish to repeat's ID
var groupId = 2;
// The number of times to repeat
var repeatNum = 3;
var form = Fabrik.blocks[formRef];
// Get the repeat group button
var btn = form.getElement('#group' + groupId + ' .addGroup');
if (typeOf(btn) !== 'null') {
// Create mock event
var e = new Event.Mock(btn, 'click');
// Duplicate group
for (var i = 1; i < repeatNum ; i ++) {
form.duplicateGroup(e);
}
}
_____________________________________