Forums

Problem with the repeater in CF8

mobusag 23 Jan, 2025

Hello everyone,

I have the following problem: I have a somewhat more complex form in which I have also included a repeater section. However, as soon as I use it, I receive the following error message after submitting:

Attempted to load class "TemplatesComponent" from namespace "Joomla\Component\Templates\Administrator\Extension".Did you forget a "use" statement for another namespace?

I think this is just a small mistake that I have overlooked somewhere, but unfortunately, I can't find the error.

I have set up the repeater as shown in the attachment, but what did I do wrong?

Does anyone have an idea?

Thanks in advance,

bambid

Bildschirmfoto-2025-01-23-um-09.19.28.png
mobusag 23 Jan, 2025
Answer
1 Likes

Hello everyone,

I found the solution! I had to add an underscore (_) before the [n] in the file names, and voilà – it worked.

Sorry for the trouble.

Best regards,bambid

Max_admin 23 Jan, 2025

Hi bambid

where exactly did you add the "_" ? can you show as screenshot ?

The error you posted earlier is a PHP error about loading a wrong class, something unrelated to the repeater fields names!!

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mobusag 23 Jan, 2025

Hello Max,

I'm happy to send you a screenshot. At the end of the field name, I had to add an underscore before the array brackets.

Now it works so far, but unfortunately, the file is not being uploaded. In CF6, I had to include an upload action in the submit section, which is now missing in CF8.

I also had to create a loop for the email and TCPDF sections, which generated a separate text section for each repeater entry. How can I implement this in CF8?

Can you help me with this?

Thanks in advance,bambid

Bildschirmfoto-2025-01-23-um-11.25.36.png
Max_admin 23 Jan, 2025

I'm not sure why would the _ underscore affect that error, it seems like a conflict with something else on your website as the repeater works fine for everyone else without the _

Regarding the loop, you can loop using HTML view with PHP enabled:

<?php foreach($this->data("fieldname") as $k => $value): ?>
Field1 = <?php echo $this->data("fieldname")[$k];<br>
Field2 = <?php echo $this->data("fieldname2")[$k];<br>
Field3 = <?php echo $this->data("fieldname3")[$k];<br>
<?php endforeach; ?>

place the HTML inside Output Buffer action (it will capture the output of the HTML into buffer) and use the {var:output_buffer_name} in your Email or TCPDF output

For the Upload inside the repeater, this is not yet supported, I will try to have a working fix in the next update

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mobusag 20 Feb, 2025

Hello Max,

Are there any updates on this? I tested it with the latest version and have the feeling that it should work. If that’s the case, I have a minor issue: In CF6, the upload happened during submit, and I was able to create a folder with a random number, allowing me to place the uploaded file inside.

However, now the upload happens before the submit, and the folder does not yet exist because I create it using PHP during submit. As a result, the upload fails, saying that the folder does not exist.

I could create the folder in advance, but then I have the problem that a folder is created every time the page is loaded. That’s not ideal, as I would end up with hundreds of empty folders.

Do you have any idea how I could work around this?

Best regards,Bambid

Max_admin 20 Feb, 2025

Hi Bambid

The upload inside the Repeater should be working now, and in order to create a folder BEFORE the upload, you need to use the "Pre Submit" action inside the Load event and have a PHP inside it to create the folder for you

The Pre Submit action runs just after the submit is done and before the submit routine is processed, including the files uploads

it should look like this:

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mobusag 21 Feb, 2025

Hello Max,

Thanks, the upload is working now. What I don't fully understand is the part with the loop. I have the image above that I would like to display within the loop so that it appears in the email and TCPDF.

Unfortunately, I’m not sure how to handle this correctly. Could you provide me with an example using two fields so that I can implement the rest myself?

Thank you!

Best regards,Bambid

Max_admin 21 Feb, 2025

Hi Bambid

What loop ? there are no loops in your images

if you mean displaying the images uploaded in the repeater then you can have your loop inside an Output Buffer action then pass the buffer variable to the email or PDF action:

{var:output-buffer-name}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mobusag 21 Feb, 2025

Hello Max,

Sorry for my unclear wording. I have a repeater area in the form with a file upload, a text field, a dropdown, two additional text fields, three more dropdowns, and a text box.

I would like to display these contents in the email and TCPDF, with each file having its own row or line in a table.

In the past, I solved this using a loop and filled the table rows accordingly.

How can I achieve this?

Thanks a lot!

Best regards,Bambid

Max_admin 21 Feb, 2025

Another Loop inside Output Buffer then you can use the buffer variable anywhere, in HTML, Email or TCPDF

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.