PHP usage in Tables

access table row data in ChronoForms 8.

Overview

The issue is confusion over the correct syntax to retrieve data from other columns in the same row when using PHP code in a table column field.
Use a PHP action in the blue lines section. Within the PHP code, retrieve the data using the specified syntax and ensure to echo the value, not return it.

Answered
ChronoForms v8
Elita- Elita- 04 Feb, 2025

Hi Max,

I believe you’re the only one who can clarify the following for now:

ChronoForms 8 provides two ways to add PHP code to a table column field:

  1. In the "blue lines" section below the table name.
  2. Using Behaviours → Output.

My question is: How can I access table row data?

In CF6, the syntax was: $this->get('table_name.row.Model.field_name');

In Behaviours → Output, I found that this syntax works: $row["field_name"]

However, this does not work in the "blue lines" section. 

Could you please clarify:

  • What is the best approach to execute PHP code in a table row column field?
  • What is the correct syntax to retrieve data from other columns in the same row to use that data in PHP code?

Thanks,

Elita

Max_admin Max_admin 04 Feb, 2025
Answer
1 Likes

Hi Elita

1- just use a PHP action in the blue sections (lines)

2- without PHP: {var:row.column_name}

and in PHP:

$this->get("row.column_name")
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Elita- Elita- 04 Feb, 2025
1 Likes

That was my thought too, judging from the debug output, but it wasn’t returning anything...Until I realized - I needed to echo that value, not return it! 🙈

Thanks!

Elita

This topic is locked and no more replies can be posted.