[Zope3-Users] Formlib and action conditions

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Jun 20 16:43:02 EDT 2007


On Wednesday 20 June 2007 13:55, Daniel Nouri wrote:
> May I suggest that the fact that you wouldn't expect anything else is
> because you know the implementation?

No, I just have written z3c.form and I implemented the same semantics there. 
Simply because it makes sense to me.

> I've been using my form to tie together a search form and search results.
> Now when I click search, the 'search' action shouldn't be visible anymore.
> What the user gets instead is a 'refine search' action that brings them
> back to the search form.

The problem here is that you take the wrong piece of data to decide whether a 
button is there or not. I would work with a session varaible that is 
explicitely set during an action. Once the action has completed its work I 
would re-update the actions.

I have build similar functionality a lot myself and never had problems, 
because I simply use more robust methods to signalize a change in behavior.

> Isn't it reasonable to expect an action to 
> execute although it's not visible when the form is rendered again?

Nope. For me the condition is a condition of availability and not visibility.

> I know I'm not the only one who has been bitten by this.  I consider it a
> pitfall.

You always have the choice to change this piece of the framework and implement 
your own action handling code. I *think* it is easy to do in zope.formlib and 
I *know* is is easy in z3c.form.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list