Form introduction: Getting the repeat group data correctly?

attilakalmar

New Member
Hi Guys,

I facing an issue. For example, I have a contact list, with a repeat group. If the repeat group has only 1 person data the standard placeholders works. Let me say 1 contact with name John Doe:

{new: Adding new}
{edit: You are editing [clients_25_repeat___client_firstname], [clients_25_repeat___client_lastname], Client ID: [clients_25_repeat___base_ids]}

Result: "You are editing John, Doe, Client ID: DOE1234"

But sometimes a contact has 2 people as they are a couple. For example John Doe and Susan Whoever. So what is on the top will result:

You are editing John, Susan, Doe, Whoever, Client ID: DOE1234, WHOE4321

How can I separate the repeated group data, and show the Firstname 1 Lastname 1 Firsname 2 Lastname 2?
 
One way would be to add hidden calc element to your repeat group with code like:
return '{clients_25_repeat___client_firstname}'." ".'{clients_25_repeat___client_lastname}';
And set "Only calc on save" to "Yes".

Then use the calc element instead of first and lastname elements.

Or add calc element to you "main" list (not repeat group) . And get the names and ID-s with a query like:
Code:
$mydb = JFactory::getDBO();
$mydb->setQuery("SELECT client_firstname, client_lastname, base_ids FROM clients_25_repeat WHERE parent_id = '{rowid}' ");
$rows = $mydb->loadObjectList();

foreach ($rows as $row) {
   $myhtml .= $row->client_firstname." ".$row->client_lastname." - ".$row->base_ids."<br>";
}
return $myhtml;

And again, set "Only calc on save" to "Yes".

Instead of calc element you could also add the code straight to form intro with Joomla's Sourcerer plugin.
 
Last edited:
One way would be to add hidden calc element to your repeat group with code like:
return '{clients_25_repeat___client_firstname}'." ".'{clients_25_repeat___client_lastname}';
And set "Only calc on save" to "Yes".

Then use the calc element instead of first and lastname elements.

Or add calc element to you "main" list (not repeat group) . And get the names and ID-s with a query like:
Code:
$mydb = JFactory::getDBO();
$mydb->setQuery("SELECT client_firstname, client_lastname, base_ids FROM clients_25_repeat WHERE parent_id = '{rowid}' ");
$rows = $mydb->loadObjectList();

foreach ($rows as $row) {
   $myhtml .= $row->client_firstname." ".$row->client_lastname." - ".$row->base_ids."<br>";
}
return $myhtml;

And again, set "Only calc on save" to "Yes".

Instead of calc element you could also add the code straight to form intro with Joomla's Sourcerer plugin.

Thank you! It works!
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top