J3 Issue ?
avatar Denitz
Denitz
3 Sep 2016

Native Protostar template - no frontend article layout overrides:

Steps to reproduce the issue

Load form with <fields name="attribs"> custom fields via onContentPrepareForm event.
Edit article in frontend, no form fields are displayed

Load form with <fields name="params"> custom fields via onContentPrepareForm.
Edit article in frontend, form fields are displayed
Fill in fields and save article.
No data is saved.

Expected result

Custom <fields name="attribs"> are displayed and saved in frontend - same as in backend.

Actual result

Frontend does not display <fields name="attribs"> but <fields name="params"> which are not saved.

avatar Denitz Denitz - open - 3 Sep 2016
avatar Denitz
Denitz - comment - 3 Sep 2016

In other words:

backend displays both params and attribs fields.
frontend displays params fields only.
both frontend and backend save data from attribs fields only.

avatar Denitz Denitz - change - 3 Sep 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-09-03 14:43:41
Closed_By Denitz
avatar Denitz Denitz - close - 3 Sep 2016
avatar Denitz Denitz - close - 3 Sep 2016
avatar brianteeman
brianteeman - comment - 3 Sep 2016

Why did you close this?

avatar Denitz Denitz - change - 3 Sep 2016
Status Closed New
Closed_Date 2016-09-03 14:43:41
Closed_By Denitz
avatar Denitz Denitz - reopen - 3 Sep 2016
avatar Denitz Denitz - reopen - 3 Sep 2016
avatar Denitz
Denitz - comment - 3 Sep 2016

Sorry, re-opened.

Yes, /components/com_content/view/form/tmpl/edit.php uses the code:

<?php foreach ($this->form->getFieldsets('params') as $name => $fieldSet) : ?>

So it displays params fields only, not attribs. But these params fields will be not saved since table uses attribs.

avatar brianteeman brianteeman - change - 5 Sep 2016
Labels Added: ?
avatar n9iels
n9iels - comment - 6 Sep 2016

I can confirm this. Execpt for displaying custom fields, there is also a problem with saving.

Now it is impossible to create a plugin that save custom fields in the parameters for front- and back-end. The only way to do it now is creating a complete new fieldset and let the plugin save data in its own database table.
If you just want to add a simple custom text field this is overkill.

For the back-end you can do something like this:

<fieldset name="params">
    <field
        name="test"
        type="text"
        label="Text field"
        description="some text field"
    />
</fieldset>

The content of this field will be save inside the params row of the com_content table. Not sure way, but for the front-end you have to use a fieldset called attribs.

Note
I try to explain this as good as possible. If it is still not clear I can create a simple plugin to show the problem I have.

avatar joomla-cms-bot joomla-cms-bot - change - 2 Oct 2016
The description was changed
avatar joomla-cms-bot joomla-cms-bot - edited - 2 Oct 2016
avatar brianteeman brianteeman - change - 2 Oct 2016
Category Front End
avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Apr 2017
Status New Needs Review
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar brianteeman
brianteeman - comment - 18 Aug 2018

As the description of the option states that it is only to display them on the admin I am going to close this as expected behaviour and as it is now two years old clearly everyone else thinks it is to be expected.

avatar brianteeman brianteeman - close - 18 Aug 2018
avatar brianteeman brianteeman - change - 18 Aug 2018
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2018-08-18 16:35:55
Closed_By brianteeman

Add a Comment

Login with GitHub to post a comment