-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
belongsTo Relationship Fields Hidden Using filterFields Get Values Erased on Save #3568
Comments
@jeffcates how are you hiding the fields? |
$fields->fieldname->hidden = true
field is using the recorder finder widget fyi
Jeff Cates
Equity Ladder, LLC
… On May 30, 2018, at 9:57 PM, Luke Towers ***@***.***> wrote:
@jeffcates how are you hiding the fields?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Also - the same issue exists for the relationship field type (as a checklist) for many-to-many relationships when the field is disabled. |
@jeffcates are you able to replicate this using the test plugin in a fresh install of OctoberCMS? Please make a PR to the test plugin to demonstrate it and then I'll be able to investigate. |
It's a new install, but not with your test plugin. I will check that out. Curious - is the test plugin on the marketplace? |
@jeffcates no, it's just for developer reference and for maintainers to test issues / PRs on. |
Okay - Ive been developing for a very long time but new to OctoberCMS - could you point me in the right direction to download the test-bed and I’ll setup the test? Thanks!
Jeff Cates
Equity Ladder, LLC
… On Jun 1, 2018, at 9:20 AM, Luke Towers ***@***.***> wrote:
@jeffcates no, it's just for developer reference and for maintainers to test issues / PRs on.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@jeffcates just download it from https://github.com/octoberrain/oc-test-plugin and move it into |
Luke,
You can quickly reproduce the issue by doing the following (with a fresh
install of the test plugin):
- Open People under Test Plugin
- Edit Mary
- Pick "Fax" as her phone type
- save and close
- open mary back up - to confirm it saved
- now, add the following to line 54 of People.php model:
/*JBC: added on line 54 of Person.php model*/
public function filterFields($fields) {
//hide the field
$fields->phone->hidden = true;
}
- now, open back mary and click save and close (don't need to change
anything)
- comment out line 57 of People.php, should look like this now:
/*JBC: added on line 54 of Person.php model*/
public function filterFields($fields) {
//hide the field
//$fields->phone->hidden = true;
}
- Now, open back Mary - you will notice the phone record finder is no
longer populated
You can also confirm this behavior by checking the records in the DB
afterwards.
As you can see - its a problem in the test plugin.
I've also found a couple other problems with the way data is saved, which I
will create seperate issues for.
I absolutely love this framework / CMS. I hope to contribute and provide
value to the community, as its been helping me out quit a bit.
I would suggest that test plugin comes installed and disabled by default -
there are a lot of features in there I didn't realize the tool could do
out-of-the-box.
Take care!
Jeff
Thanks,
Jeff Cates
Equity Ladder, LLC
HomeVestors - Dallas | Fort Worth | San Antonio
(214) 310-1501
…On Sun, Jun 3, 2018 at 3:37 PM, Luke Towers ***@***.***> wrote:
@jeffcates <https://github.com/jeffcates> just download it from
https://github.com/octoberrain/oc-test-plugin and move it into
plugins/october/test
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3568 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AkjQJ6IPd_BYkyJJci1yJt6knszOCKC5ks5t5EkZgaJpZM4UUVir>
.
|
@jeffcates could you actually submit a PR with that code to the test plugin repo? I know it's a small example but I'm testing some tooling on our end created by @petehalverson that makes replicating issues much easier and having a PR submitted to the test plugin with the code that causes the issue makes life easier. Also, re the test plugin being kind of hard to find: That is done on purpose. If you look, you'll find projects that have blatantly ripped off the media manager used in October, @daftspunk wants the test plugin to be hard to find by default to prevent drive-bys of people seeing what October can do and just copying it for their own systems instead of contributing back to the community. I do agree that we need a kitchensink-esque plugin for demonstrating October's features and acting as a source of truth for the platform's features though, however I don't have the time to put something like together right now and the test plugin was initially designed for @daftspunk's personal use, not as that sort of tool. |
Tripped up on this today. Legit bug. I'll follow up when I have some time to stage the issue with the test plugin and come up with a PR. |
This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see action on it, please respond and we will get the ball rolling. |
This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see action on it, please respond and we will get the ball rolling. |
This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. |
This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. |
This bug only manifests with relations, it must be such an edge case that not enough noise was made about it. Either way, it has been fixed ready for the next release. Thanks for your patience @jeffcates |
Expected behavior
hiding a belongsTo relationship field to a user does not affect the fields value if the user edits the model
Actual behavior
belongsTo relationship fields get erased if hidden using filterFields and then the model is saved
Reproduce steps
create a model (M) with a belongsTo relationship field to another model
in filterFields function of model (M) show the field for User A and hide for User B
User A updates the relationship field and saves
User B then opens the model to view/edit other fields and clicks save
User A re-opens the model and the relationship field is now cleared / null
October build
Build 434
The text was updated successfully, but these errors were encountered: