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

Issue with some field names #109

Open
robingram opened this issue Dec 10, 2019 · 3 comments
Open

Issue with some field names #109

robingram opened this issue Dec 10, 2019 · 3 comments

Comments

@robingram
Copy link

Using dev-master on SS 4.4.

Bit of a strange one this and I was wracking my brains for about a day before I got an idea of what was going on.

We have a DataObject with a number of fields that use Display Logic. Two of these are ListboxField controls that use displayIf to control their visibility based on the value of an OptionsetField (not the same option set, different for each list box). The code to create these fields is virtually identical but for one of them the list box would never display on page load, although it would show based on the click, i.e. if I changed the option and then changed it back.

The best I could get from debugging is that the onmatch event for $('div.display-logic-master :checkbox, div.display-logic-master :radio') would not fire for this particular control, although it would for the other.

In desperation I started trying different things and eventually I renamed the DB field that was being referenced by displayIf and suddenly it started working. For some reason the code did not like the original name of the field which was "CanViewType". As far as I know this isn't a reserved word but it seemed to be affecting how Display Logic worked.

We've written a migration to change the field name so we've worked around it but thought you should be aware of this since it took me a looooong time to track down.

@GuySartorelli
Copy link

Do you happen to remember what the name was of the field that this wasn't working for?

@robingram
Copy link
Author

Only from reading back my previous post. Looks like it was "CanViewType".

@michalkleiner
Copy link
Collaborator

My guess is there's some custom JS within the CMS itself using this particular field which then interferes with Display Logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants