General developer forum

Repeat group of elements (in form)

 
Picture of André Camacho
Re: Repeat group of elements (in form)
 

Ok so here some news, after hours trying, I found some of problems :

1. To not let the group appear once before repeating, or when you want to create a group that will be put in array for repeat, you should use createElement instead of addGroup.

https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#Use_Fieldsets_to_group_Form_Elements#addGroup

2. Still didn't find how to do it. I can get number of repetitions actually showed by doing :

$this->_form->_elements[9]->_attributes['value']
How to make "add fields" button disable when value is something ?

3. Managed to make it work, don't know what was the problem.

I think I was using two ways to set it, replaced with only the good one (for repeaters, in options, like that smile

$repeatoptions['my_field']['disabledif'] = array('field_to_check', 'eq', 0);


Thank you very much for reading me.

If anyone has an idea for the problem #2, I'll be there ! Thanks again !


 
Average of ratings: -