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

depends_on not working in easyform 3.2.0 and plone 5.2 #380

Open
Nimo-19 opened this issue Nov 23, 2022 · 2 comments
Open

depends_on not working in easyform 3.2.0 and plone 5.2 #380

Nimo-19 opened this issue Nov 23, 2022 · 2 comments

Comments

@Nimo-19
Copy link
Contributor

Nimo-19 commented Nov 23, 2022

I just saw the depends_on feature and was exited, but somehow I cant get it to work with easyform 3.2.0.
Is there some other dependency?

The form view page does not seem to do anything with this feature.

My barebones buildout

[buildout]
extends =
    http://dist.plone.org/release/5-latest/versions.cfg

parts =
    instance

versions = versions

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
http-address = 8080
eggs =
    Plone
    collective.easyform


[versions]
collective.easyform = 3.2.0

My schema for the fields

<model xmlns:i18n="http://xml.zope.org/namespaces/i18n" xmlns:marshal="http://namespaces.plone.org/supermodel/marshal" xmlns:form="http://namespaces.plone.org/supermodel/form" xmlns:security="http://namespaces.plone.org/supermodel/security" xmlns:users="http://namespaces.plone.org/supermodel/users" xmlns:lingua="http://namespaces.plone.org/supermodel/lingua" xmlns:easyform="http://namespaces.plone.org/supermodel/easyform" xmlns="http://namespaces.plone.org/supermodel/schema">
  <schema>
    <field name="replyto" type="zope.schema.TextLine" easyform:TDefault="python:member and member.getProperty('email', '') or ''" easyform:serverSide="False" easyform:validators="isValidEmail">
      <description/>
      <title>Your E-Mail Address</title>
    </field>
    <field name="hidden" type="zope.schema.Bool" easyform:serverSide="False" easyform:THidden="False">
      <description/>
      <required>False</required>
      <title>hidden</title>
      <form:widget type="plone.app.z3cform.widget.SingleCheckBoxBoolFieldWidget"/>
    </field>
    <field name="test" type="zope.schema.TextLine" easyform:depends_on="condition:form.widgets.hidden" easyform:serverSide="False" easyform:THidden="False">
      <description/>
      <required>False</required>
      <title>Test</title>
    </field>
  </schema>
</model>
@fredvd
Copy link
Member

fredvd commented Dec 6, 2022

@Nimo-19 Hi, I ran into other issues while testing this feature on Plone 6. But for Plone 5.2 I assume you at least need to install plone.patternslib as a separate add'on, it adds extra patterns from patternslib that don't conflict with the ones in Plone 5.2.

The pat-depends pattern is included in Plone 6's classicUI patterns.

@Nimo-19
Copy link
Contributor Author

Nimo-19 commented Dec 14, 2022

But for Plone 5.2 I assume you at least need to install plone.patternslib as a separate add'on

Thanks for the answer. I expected something like this.
Should this be documented somehow or should the plone.patternslib be added as an (extra?) dependency to the setup.py?
Is it maybe possible to check for an installed Layer for displaying the depends on field?

I would try to come up with a pull request, I'm just not sure what the correct way is.

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

No branches or pull requests

2 participants