Re: [Zope3-Users] Form for list of lists

2005-04-15 Thread Cliff Ford
Thanks (roger) for the tips. I was trying to use a single custom widget 
- taking that out gave the expected default behaviour. I needed a much 
more customised form, so after many false steps, and for the benefit of 
anyone else who needs to know this is what I did:

1. Put an 'update' method definition in the thingy content type 
Interface and Class Implementation.

2. Created a custom thingy Page Template for the edit form.
3. Used template="thingy_template.pt" and 
class="site.thingy.thingyClass" definitions in the editform 
configuration. (No custom widgets.)

Seems very simple! I guess the problem for the Zope 3 newcomer is 
knowing which bits if the framework to use and which to replace.

Cliff
Roger Ineichen wrote:
Hi Cliff 

From: [EMAIL PROTECTED] 

[mailto:[EMAIL PROTECTED] On Behalf Of Cliff Ford
Sent: Thursday, April 14, 2005 9:43 AM
To: Zope3-users@zope.org
Subject: [Zope3-Users] Form for list of lists
I have a list of lists that I need to manipulate with a form. I have 
figured out how to get the list elements into a form with a Page 
Template. However, the field names come out like this:

0 field.listname.0. field.listname.1. field.listname.2.
1 field.listname.0. field.listname.1. field.listname.2.
2 field.listname.0. field.listname.1. field.listname.2.
...
where the first integer is just the value of 
repeat/item/index and the 
first element represents listname[0][0].

I have a widget derived from SimpleInputWidget to handle the form 
elements (all strings).

I don't know how to get the updated form values back into the list of 
lists, or even the best/correct approach to this whole problem. Can 
anyone provide some pointers?

Use the Field "List" in your interface for describe the list attribute.
Then use the standard "editform" directive with the right schema and 
all is handled by the form framework.

Then you should get values like:
field.list.0.name.0 field.list.0.name.1 field.list.0.name.2
field.list.1.name.0 field.list.1name.1 field.list.1.name.2
If you like to use a own edit form, you can call
request.get('yourfieldname', None)
for get a value. But make sure the fields have unique numbers.
Right now it seams each row uses the same numbers. 

Regards
Roger Ineichen

Cliff
PS: Has yesterday's question from Dylan Reinhardt been answered 
off-list? I will be doing the same thing next and was 
interested in any 
answers.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


RE: [Zope3-Users] Form for list of lists

2005-04-14 Thread Roger Ineichen
Hi Cliff 

From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Cliff Ford
> Sent: Thursday, April 14, 2005 9:43 AM
> To: Zope3-users@zope.org
> Subject: [Zope3-Users] Form for list of lists
> 
> I have a list of lists that I need to manipulate with a form. I have 
> figured out how to get the list elements into a form with a Page 
> Template. However, the field names come out like this:
> 
> 0 field.listname.0. field.listname.1. field.listname.2.
> 1 field.listname.0. field.listname.1. field.listname.2.
> 2 field.listname.0. field.listname.1. field.listname.2.
> ...
> 
> where the first integer is just the value of 
> repeat/item/index and the 
> first element represents listname[0][0].
> 
> I have a widget derived from SimpleInputWidget to handle the form 
> elements (all strings).
> 
> I don't know how to get the updated form values back into the list of 
> lists, or even the best/correct approach to this whole problem. Can 
> anyone provide some pointers?

Use the Field "List" in your interface for describe the list attribute.
Then use the standard "editform" directive with the right schema and 
all is handled by the form framework.

Then you should get values like:

field.list.0.name.0 field.list.0.name.1 field.list.0.name.2
field.list.1.name.0 field.list.1name.1 field.list.1.name.2


If you like to use a own edit form, you can call
request.get('yourfieldname', None)
for get a value. But make sure the fields have unique numbers.
Right now it seams each row uses the same numbers. 

Regards
Roger Ineichen

> Cliff
> 
> PS: Has yesterday's question from Dylan Reinhardt been answered 
> off-list? I will be doing the same thing next and was 
> interested in any 
> answers.
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Form for list of lists

2005-04-14 Thread Cliff Ford
I have a list of lists that I need to manipulate with a form. I have 
figured out how to get the list elements into a form with a Page 
Template. However, the field names come out like this:

0 field.listname.0. field.listname.1. field.listname.2.
1 field.listname.0. field.listname.1. field.listname.2.
2 field.listname.0. field.listname.1. field.listname.2.
...
where the first integer is just the value of repeat/item/index and the 
first element represents listname[0][0].

I have a widget derived from SimpleInputWidget to handle the form 
elements (all strings).

I don't know how to get the updated form values back into the list of 
lists, or even the best/correct approach to this whole problem. Can 
anyone provide some pointers?

Cliff
PS: Has yesterday's question from Dylan Reinhardt been answered 
off-list? I will be doing the same thing next and was interested in any 
answers.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users