I have several repeated groups in form that are displayed and hidden based on selections made by the users (default: hidden). In order to not populate the database with empty info, I had to set the "Repeat minimum" option to 0 (zero).
But in some cases, i need to set the repeat group elements to be visible by default instead of asking user to press the + button. I know that i can set "Repeat minimum" to 1 but this will record an empty row in the table for other users who doesn't see this group.
Then i tried to unset the group using a php form plugin but every time a element validation failed in form (outside or inside the repeated group), the repeated group set its div to read-only (class="fabrikElementReadOnly")
this is the code i've used for unset:
also tried with $formModel->getElementData('contracts_tool_servicii_765_repeat___adresa_anexa_vpn_nou', true,'',0), same problem.
So, how can i display the repeated groups element to be visible by default but also stop recording empty rows in tables?
Thank you
But in some cases, i need to set the repeat group elements to be visible by default instead of asking user to press the + button. I know that i can set "Repeat minimum" to 1 but this will record an empty row in the table for other users who doesn't see this group.
Then i tried to unset the group using a php form plugin but every time a element validation failed in form (outside or inside the repeated group), the repeated group set its div to read-only (class="fabrikElementReadOnly")
this is the code i've used for unset:
PHP:
if (JFactory::getApplication()->input->get('task', '') == 'form.process') {
switch ($groupModel->getId()) {
case 765:
foreach ($formModel->formData["contracts_tool_servicii_765_repeat___adresa_anexa_vpn_nou_raw"] as $anexa_vpn) {
if ($anexa_vpn == ''){
return false;
}
}
break;
default:
return true;
}
return true;
}
return true;
also tried with $formModel->getElementData('contracts_tool_servicii_765_repeat___adresa_anexa_vpn_nou', true,'',0), same problem.
So, how can i display the repeated groups element to be visible by default but also stop recording empty rows in tables?
Thank you