digitalDave
Member
Hello
I have created a form with a repeat group, the add and remove buttons are hidden in CSS.
I would like to create my own add repeat button.
I have this function in form_X.js
And I call it with this code on a button click
But I get this error
Uncaught TypeError: can't access property "form", form is undefined
Can someone show me what mistake I am making?
I have created a form with a repeat group, the add and remove buttons are hidden in CSS.
I would like to create my own add repeat button.
I have this function in form_X.js
JavaScript:
function addGroup(formRef, groupId) {
var form = Fabrik.blocks[formRef];
// Create mock event
var btn = form.getElement('#group' + groupId + ' .addGroup');
if (typeOf(btn) !== 'null') {
var e = new Event.Mock(btn, 'click');
// Duplicate group
form.duplicateGroup(e);
}
}
And I call it with this code on a button click
JavaScript:
var formRef = 'form_17';
addGroup(formRef, 100);
But I get this error
Uncaught TypeError: can't access property "form", form is undefined
Can someone show me what mistake I am making?
Last edited: