Re: Invariant between behaviors? (DX/z3cform)

espen <[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
(hope I understand the question right)


Could you enable the field for an interface and let this interface be added when B is set ?

actually, you could put them both in the same behavior (if you want to), but register the fields for different interfaces 

I found some code in collective.plonetruegallery or easyslider that I have used here:
https://github.com/collective/medialog.galleryviewlet/blob/master/medialog/galleryviewlet/interfaces.py

Which is enabled here:
https://github.com/collective/medialog.galleryviewlet/blob/master/medialog/galleryviewlet/browser/configure.zcml#L42

so: when FieldA is set, you need to call (for exaple) a browserview that enables the interface

—————

Another option could be to do this with javascipt
(I should have some working code for that somewhere)

I did  something similar this way:
When the content is added, field B is set to «unset» (or some other dummy text) and hidden with javascript
When field A is set, a javascript  shows fields B, and sets its content to ‘’(empty) ….. (so it is basically requred all the time, but it has a «dummy» value before field A is set.

Espen

15. sep. 2014 kl. 12:54 skrev Jens W. klein-2 [via Plone] <ml-node+s293351n7572477h40-PKuAHvtXa09l57MIdRCFDg@public.gmane.org>:

> z3cform/ dexterity question: 
> 
> I have a custom behavior "A" with a field "myfield". 
> 
> Now I want an invariant validation to have this field required only if 
> 'otherfield' on an other behaviour "B" was set. 
> 
> In my invariants 'data' on A does not contain 'otherfield' (only myfield). 
> 
> How can i access the values from B in my invariant on A? 
> 
> regards Jens 
> -- 
> Klein & Partner KG, member of BlueDynamics Alliance 
> 
> 
> ------------------------------------------------------------------------------ 
> Want excitement? 
> Manually upgrade your production database. 
> When you want reliability, choose Perforce 
> Perforce version control. Predictably reliable. 
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________ 
> Plone-Users mailing list 
> [hidden email] 
> https://lists.sourceforge.net/lists/listinfo/plone-users
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://plone.293351.n2.nabble.com/Invariant-between-behaviors-DX-z3cform-tp7572477.html
> To start a new topic under General Questions, email ml-node+s293351n293352h65-PKuAHvtXa09l57MIdRCFDg@public.gmane.org 
> To unsubscribe from Plone, click here.
> NAML





--
View this message in context: http://plone.293351.n2.nabble.com/Invariant-between-behaviors-DX-z3cform-tp7572477p7572478.html
Sent from the General Questions mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk

_______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.