Forum

Thread tagged as: Problem, Api
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. How can I help?

What I'm trying to do is this:

  • Control content on a page using a form built with the $Form API Class.
  • The form will contain multiple text fields and one textarea field (which will be a WYSIWYG).
  • The table that the fields feed into does not contain Dynamic Fields; all Fields are static.

Is this possible? I'm able to get all the information needed through $details = $Course->to_array();, but that doesn't help me feed the information back in.

All text fields were working (they've been affected during development, but the code for them is still accessible), but the textarea field is not working. Either I get no WYSIWYG editor, or I get one but the field doesn't seem to sync up with anything on the front end.

Any ideas? Thanks.

Duncan Revell

Duncan Revell 78 points
Registered Developer

I had a similar issue a couple of years ago

As Drew says, you have to use a template to get this to work. In my case, my "dynamic fields" consisted of just one "template field" (also a textarea). In database terms, the table doesn't need to have a dynamic field (or column) - the column just needs to be configured to contain text. The value from your template field is stored in the text column in json format. If your template had more than one field, the column would store all those fields, in json format.

Your confusion may match my initial confusion - in the example Drew gives, "static fields" means "fields defined in the post.php page that will never be changed by a template" and "dynamic fields" means "fields defined in a template that can be altered by a user providing a new template".

Hope that isn't more confusing!

Hi Duncan,

Thanks for the help - I've actually just fixed the issue by re-shuffling my database to accept the information that Perch puts through the way it was putting it through beforehand.

Thanks, Harry