1
votes

I followed this tutorial on how to build a component for joomla 2.5, but now I am stuck.

What I want to do: Besided thoses field defined in admin\models\forms\.xml I want to dynamically add form fields. The field list should be read from database.

I have a:

  • main table #__tours(id, title),
  • field list table #__tourfields(id,lable,description,position)
  • field value table #__tourfieldvalues(tourid,fieldid,fieldvalue)

#__tourfields contains a list of additional fields, that the user may want to specify for each entry in #__tours. #__tourfieldvalues would contain the values for the additional fields.

So now I need to figure out how to add input boxes to the edit form for each row in #__tourfields, read the values in #__tourfieldvalues for the currently to display entry of #__tours.

How can I do this?

1
Have you experimented with calling from the database and using a foreach statement?Lodder

1 Answers

0
votes

This is very complex question. Subject to small book :)

In general you have to create class for every field type and initiate this class for every field in #__tourfields. This class have to extend JFormField and have getInput() method overridden.

Then in cycle you fetch your fields.

Something like this. But I believe you have to have more specific question. This one sounds like "How to create CMS like Joomla from scratch?"