No Code Attached Yet
avatar angieradtke
angieradtke
7 Feb 2022

Steps to reproduce the issue

I have two com_contact categories and assign different custom fields to these categories in the email form.
This leads to a mess in the frontend. The custom fields do not know to which category
they belong and when switching between the different contact forms,
the fields are alternately assigned to one or the other category.

The issue is located in:
components/com_contact/src/View/Contact/HtmlView.php
The form is displayed before the category is assigned

 Line: 136 $this->form = $this->get('Form');
		.......
		// Add catid for selecting custom fields
		$data['catid'] = $item->catid;

Turn around and it works like expected.

avatar angieradtke angieradtke - open - 7 Feb 2022
avatar joomla-cms-bot joomla-cms-bot - change - 7 Feb 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Feb 2022
avatar brianteeman
brianteeman - comment - 7 Feb 2022

If you have the solution then please submit a pull request

avatar angieradtke
angieradtke - comment - 7 Feb 2022

@brianteeman If it was that easy for me, I would do that. But it isn't.

avatar brianteeman
brianteeman - comment - 7 Feb 2022

I'm sure you are more than capable of doing it. Its really not hard for someone with your skills

avatar joomdonation
joomdonation - comment - 7 Feb 2022

I made PR #35763 sometime ago to fix the issue with Joomla 4. It had some unsuccessful test but I could not see it myself. I will try to look at it again one more time.

avatar brianteeman
brianteeman - comment - 7 Feb 2022

It is very easy and you should learn

angie

avatar prakhar3062
prakhar3062 - comment - 9 Feb 2022

Can i work on this issue

avatar joomdonation joomdonation - change - 12 Feb 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-02-12 11:53:53
Closed_By joomdonation
avatar joomdonation joomdonation - close - 12 Feb 2022
avatar joomdonation
joomdonation - comment - 12 Feb 2022

@angieradtke Could you please test PR #35763 ? It should address this issue. If it is success, we can backport the change to Joomla 3.10 if required.

avatar angieradtke
angieradtke - comment - 13 Feb 2022

@brianteeman thanks for your advice. I always have probs to sync my local branch with my branch om git and and this one with joomla current. The issue is that I not often work on Joomla and my local branch is a lot behind the current Joomla one. So first I have to fetch upstream - and here the chaos starts. I talk to Niels , Hannes etc and they try to help me, but ...
I try with git desktop and my php storm. I remember svn " create patch" and things happen.

avatar angieradtke
angieradtke - comment - 13 Feb 2022

@joomdonation

Hi Tuan,
your solution is different from mine.
I only change the order of the code in the view.
You are the php coder so I think your solution is the better one. But can you explain me why.
I will test now.

avatar brianteeman
brianteeman - comment - 13 Feb 2022

I'm sure they will have told you to always start on a new branch. That way you will never have the issue you refer to. Or for simple pr like this one just do it online as I showed.

avatar joomdonation
joomdonation - comment - 13 Feb 2022

@angieradtke In short, the code in view is not needed, so I removed. Normally, view should receive data from model to render/display. For some reasons, here in Contact view, we have strange code to manipulate the data and then pass it back to session for model to use to. It's not right (at least as I understand)

Your solution also solves the problem. But having these lines of code in view is unnecessary (and not right to me, too).

avatar angieradtke
angieradtke - comment - 14 Feb 2022

@joomdonation thank you

Add a Comment

Login with GitHub to post a comment