Dynamic Driven Element Label?

Status
Not open for further replies.

nbradshaw

Active Member
I have a repeat group table (please see attached) and I would like to added the dates to the M-S element labels (below M-S). Is there a way to do this?

If that is not possible, I was thinking I could perhaps use the first row for this purpose but I would need to lock down the first row (read only - unable to delete)...and figure how to only do a db join query on the first row only. This would also allow it to show up the same way in the List.

Any ideas?

Thanks -
 

Attachments

  • fabrik_projects.JPG
    fabrik_projects.JPG
    49.1 KB · Views: 42
What are "the dates"? There's lots of Mondays through Sundays. Not quite an infinite number, but several billion years worth till the Earth gets consumed by the Sun as it enters its red giant phase.

(Philosophically speaking, I guess Mondays continue even after the planet ceases to exist (which is kind of a depressing thought), but that's kind of a Zen thing ... if a tree falls in the forest and nobody hears it, etc)

-- hugh
 
Well - I already had an idea on how to address the dates part.

I have this about figured out..I just need some help on a custom template.

Code:
$db = JFactory::getDbo();
$query = "select start_date FROM project_time_tracker WHERE id = '{rowid}'";
$db->setQuery($query);
$mon = $db->loadResult();

What is the correct syntax to get the rowid in my query in a custom form template?

When I jdump $query...I get: select start_date FROM project_time_tracker WHERE id = '{rowid}' instead of say: select start_date FROM project_time_tracker WHERE id = '2'

Also uploaded my custom default_repeatgroup_table.php file.
 

Attachments

  • default_repeatgroup_table.txt
    3.4 KB · Views: 27
Last edited:
Ok...found my answer...this one took a while to dig up.

Code:
$id = $this->groups['Project Time Tracker']->elements['id']->value;
 
Yup, placeholders don't work in templates, as templates aren't code that Fabrik evals. Placeholders only work in code that you enter in a setting in the Fabrik backend, which Fabrik can then do substitutions on, before handing to PHP to run ("eval"). Code which is stored in files which is run through "normal" mechanisms (like 'require' or 'include') can't use placeholders.

The easiest way to get the rowid is $this->getModel()->getId().

Remembering that it'll be blank if this is a new form.

-- hugh
 
Hi Hugh - I am revisiting this...it looks like $this->getModel()->getId() grabs the form id, but not the row id. Do you know how to get the row id? I found this out via a jdump.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top