show empty group on change in..

earobins

Member
I have a repeating group with the minimum repeats = 0 & the maximum repeats = 5. Whether or not it is hidden is controlled by a dropdown element called "copresenters." If the copresenters = 0, the repeating group should be hidden. Once the copresenter value changes to anything > 0, I would like the repeating group to be shown, so that the user can enter their information. The fields in the repeating group will start out empty. Right now, when the copresenter value changes to anything > 0, the repeating group label is shown, with the "no data" message and +/-. I would like the empty fields to be shown for the first iteration, without the user having to click on the + sign. It was working this way until I upgraded to Joomla! 2.5.18 & Fabrik 3.1. Is there a setting that I missing? Thanks.

The repeating group is set to show group: yes;
The copresenters (dropdown) has the following javascript applied to:
1. hide the group if copresenters = 0 onload
2. show the group if copresenters => 1 onchange
3. show the group if copresenters => 1 onload (this really shouldn't happen)

I am attaching images of:
1. this portion of the form with the way it loads with the copresenters = 0;
2. the "no data" message when the copresenters changes to >0,
3. the way I would like it to look with the first group of empty fields.
4. the copresenters javacript (from the backend/not expanded)

I am using the template: labels-above25
Capture.JPGCapture1.JPGCapture2.JPG
Capture3.JPG
 
Do you need to be able to set the # of presenters to 0? If not the simplest solution would be to set the min repeat group count to 1.
Otherwise you would need to add some custom js onto your copresenters element

event: change:
code:
JavaScript:
// Replace the 1 in 'form_1' with your form id
var form = Fabrik.getBlock('form_1');
// Replace this with the repeat group's id.
var groupId = 2;
 
var btn = form.form.getElement('#group' + groupId + ' .addGroup');
var event = new Event.Mock(btn , 'click');
form.duplicateGroup(event);
 
Thanks, Rob. It is valid to have 0 copresenters. This code should just go inline in the space provided for the element, correct?
I made the replacements and put the code on the drop down element, but then the repeat group didn't display at all.

var form = Fabrik.getBlock('form_2');

var groupId = 16;

var btn = form.form.getElement('#group' + groupId + ' .addGroup');
var event = new Event.Mock(btn , 'click');
form.duplicateGroup(event);
 
We'll need to see the page. Can you fill out your My Sites (look to the left of any of your posts), and include any instructions we need to find the right page, etc.

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

Thank you.

Members online

Back
Top