Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Fix custom fields on Contact Form #35763

Merged

Conversation

joomdonation
Copy link
Contributor

@joomdonation joomdonation commented Oct 5, 2021

Pull Request for Issue #35609, #36961, #36956.

Summary of Changes

This PR fixes issue #35609 by removing unnecessary code from view class:

Testing Instructions

  1. Create two contact categories.
  2. Created two Mail contact custom fields, each field assign to a category.
  3. Create two contacts, each contact assigned to one category.
  4. Create two menu items link to Contact -> Single Contact menu item type of com_contact. For each menu item, choose a contact from the two created above.

Actual result BEFORE applying this Pull Request

  1. Access to the first menu item (which links to contact 1)
  2. The access to the second menu item (which links to contact 2). Instead of seeing custom fields assign to Category 2, you see custom fields assigned to Category 1 (because the catid is wrong remembered in session)

Expected result AFTER applying this Pull Request

  1. Access to first menu item, you see custom fields from category 1
  2. Access to second menu item, you see custom fields from category 2 (not custom fields from category 1 as before - which is wrong)

Please note that after applying patch, you should closer your browser and re-open it to clear existing session data (or better, use a different browser to test the new behavior).

@GennaroMarra
Copy link

Good morning I had already communicated that I had tested the solution that turned out to be working. In the last release of Joomla, i.e. version 4.0.3, has the reported bug been fixed? Thank you

@joomdonation
Copy link
Contributor Author

@GennaroMarra Each PR needs two successful tests to be merged. Please go to https://issues.joomla.org/tracker/joomla-cms/35763 and report your test result.

Then we will need to have one more test before it could be merged.

@GennaroMarra
Copy link

The test was successful. Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35763.

@BertaOctech
Copy link

Hi,

I was testing this issue but I have not been able to reproduce the error.
I followed the testing instructions but each contact showed its own fields. There was no error I am afraid.

Cheers,
Berta


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35763.

@joomdonation
Copy link
Contributor Author

joomdonation commented Oct 22, 2021

@BertaOctech Thanks for testing. When you access to first menu item, the system will display custom fields from first contact category properly.

However, when you access to the second menu item, you will see custom fields from first category (which is wrong - it should display custom fields from second category). Could you please try again one more time?

Thanks !

@pabloarias
Copy link

Yes, agree with @BertaOctech. Not able to show custom field value from one contact in the other one.

Thank you and best regards


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35763.

@BertaOctech
Copy link

@BertaOctech Thanks for testing. When you access to first menu item, the system will display custom fields from first contact category properly.

However, when you access to the second menu item, you will see custom fields from first category (which is wrong - it should display custom fields from second category). Could you please try again one more time?

Thanks !

Hi, thanks for your comment.
When I accessed the second item the custom fields from the first category disappeared and only the field from the second category were shown.

Maybe this issue was solved via another issue, sometimes this happen.
Cheers,
Berta


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35763.

@joomdonation
Copy link
Contributor Author

@BertaOctech Thanks for testing. Strange that you see it work properly. It is still not working, maybe someone you can test it and confirm later (I can still see it from current code by code reading)

@pabloarias
Copy link

In testing instructions is necessary to add another step: after create new contacts, fill each field with a different value, right?

I've created a Calendar field for Category 1 and Color for Category 2. Should the fields be the same type?

Thanks

@joomdonation
Copy link
Contributor Author

@pabloarias This issue happens with custom fields display on contact form, so you do not need to enter data for these custom fields for contact. Maybe you can try to look at the original issue #35609 , it might describes the issue better than what I described here

@pabloarias
Copy link

Ok, I understand now. Custom fields are for mail form, not for contact.

I see the problem.

I'm really sorry but after applying the path, it continues failing.

One question: why these fields are shown as disabled in frontend form?

Thank you very much!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35763.

@joomdonation
Copy link
Contributor Author

@pabloarias

Ok, I understand now. Custom fields are for mail form, not for contact.

The testing instructions should be more clear. We need to create custom fields for Mail, not to Contact for this PR.

I'm really sorry but after applying the path, it continues failing.

That's strange to me. I don't see how it could still fail after the patch.

One question: why these fields are shown as disabled in frontend form?

It's something with permission settings. You need to edit the field, look at Permissions tab, select Public user group and set Edit Custom Field Value permission to Allowed. After that, all users should be allowed to enter value for that field.

Thanks for your help with testing.

@khu5h1
Copy link
Contributor

khu5h1 commented Oct 28, 2021

Hey, even I tried to test the same but it didn't work out for me as well. I think that the test instructions are to be more clear.

@Quiviro
Copy link

Quiviro commented Oct 29, 2021

I have tested this item 🔴 unsuccessfully on e919da6

Before applying the patch, both contacts show the same custom field: mail field #1.
After applying the patch, both contacts show the same custom field: mail field #2.

The error is different but remains equal


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35763.

@RickR2H
Copy link
Member

RickR2H commented Dec 15, 2021

I have tested this item 🔴 unsuccessfully on e919da6

I could reproduce the problem but after applying the patch the problem gets worse.

What I did:

  1. Create to categories in Contacts (category "left" and category "right")
  2. go to the Contacts custom fields and select type "Mail" from the dropdown
  3. Create 2 custom fields for each category (text field "cfield-left" assigned to the "left" category and text field "cfield-right" assigned to the "right" category)
  4. Create 2 contacts "Contact-left" assigned to the "left category" and "Contact-right" assigned to the "right category". Make sure the name and a valid email address is filled.
  5. Make two menu items of type is "Single Contact" for each contact.

Before the patch:

When you click on the "Contact left" menu item the contact form shows with the "cfield-left" field. Next when you click on the "Contact right" menu item the field "cfield-left" remains. After clicking a second time or after a page refresh the custom fields updates to the correct one.

before-patch

After the patch:

Only one of the fields is loaded even when switching menu items an refreshing / clicking multiple times.

after-patch


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35763.

@joomdonation
Copy link
Contributor Author

@RickR2H and others: I think I know why your tests were un-successful. The catid data is still remembered from your previous tests (before patch applied)

So somehow, after applying patch. We need to clear existing session data to have the right behavior:

  • Close the browser and re-open it (I'm unsure if that will completely removing session data)
  • Or maybe, use a different browser to test the behavior after applying patch.

@leoalv
Copy link
Contributor

leoalv commented Feb 12, 2022

This works!. I have tested it in the following scenarios: A classic form and an appointment form with extra fields, and 2 forms with custom fields of type Mail. The forms are in different categories and have different menu items.

For those that don't work, you can clear your browser's cache and cookies or try it from another browser.

@angieradtke
Copy link
Contributor

angieradtke commented Feb 14, 2022

Works like expected, thanks Tuan.
I have tested it successfully.

@Quy Quy removed the JBS label Feb 14, 2022
@Quy
Copy link
Contributor

Quy commented Feb 14, 2022

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35763.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 14, 2022
@Quy Quy removed the JBS label Feb 14, 2022
@bembelimen bembelimen merged commit f19219d into joomla:4.1-dev Mar 3, 2022
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Mar 3, 2022
@bembelimen
Copy link
Contributor

Thx

@bembelimen bembelimen added this to the Joomla 4.1.1 milestone Mar 3, 2022
@joomdonation joomdonation deleted the fix_contact_categories_custom_fields branch March 3, 2022 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet