collective / collective.easyform

Forms for Plone

Home Page:https://pypi.org/project/collective.easyform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

depends_on not working in easyform 3.2.0 and plone 5.2

Nimo-19 opened this issue · comments

commented

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>

@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.

commented

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.