AW: [Zope3-dev] enahnced widget usecase

dev at projekt01.ch dev at projekt01.ch
Fri Oct 1 10:28:18 EDT 2004


Garrett Smith wrote:
> Betreff: RE: [Zope3-dev] enahnced widget usecase
> 
> 
> dev at projekt01.ch wrote:
> > Hi together,
> > 
> > How can I handle this widget usecase:
> > 
> > A object has simply IText fields like:
> > 
> > title, description, body
> > 
> > I whould like to show a edit view where
> > the field title and description displayed but
> > not editable and the body field is rendered
> > with his relevant edit widget.
> 
> The simplest way is to define two attributes in your view class:
> 
>   title_widget = CustomWidgetFactory(DisplayWidget)
>   description_widget = CustomWidgetFactory(DisplayWidget)
> 
> You could adapt the context to a schema that had readonly
> title and description fields, but this is a lot more work 
> than explicitly specifying the widget classes to use, per the 
> example above.
> 
>  -- Garrett

Yes I know, sorry, my description of the usecase was 
unclear.

Correct usecase

The user should be able to use a display view where 
he can click on a icon next to a field and this whould
return the view with the selected field editable.
All other fields are in the display mode.

This way the field can't be declare in the schema 
as readonly.

For me a possible way is:

Declare a view which reads the request and decide if 
a icon next to a field was clicked. Then render the
relevant field as a edit widget and all other fields
as display widget.

If the widget in this view was edited and sendt back 
we can read the request and update the returned widget.
Then render all fields as display widget and return 
the view again to the browser.

Why such a usecase?

This could be usefull if we have stx or restx source fields
where you have to check the output in a display view.
And it's not possible to see the correct output of
a restx field in the edit view.

Is this right?

Regards
Roger






More information about the Zope3-dev mailing list