Hi,

I was playing with tw_samples and have a question about "repetitions"
parameter of FormFieldRepeater. From js_forms.py:

        # We wrap the address fieldset with a FormFieldRepeater to
handle
        # repetitions. This can be done with *any* FormField.
        address = FormFieldRepeater(
            widget = AddressFieldset(),
            repetitions = 2,
            max_repetitions = 5
            )

When the form is displayed, address fieldset is repeated twice. But if
I assign three addresses to a person person.addresses =
[dict(street='street1), dict(street='street1), dict(street='street1')]
only the first two are displayed. I thought the widget will
authomagically adjust the number of address fieldsets to the number of
available addresses,  with the maximum of 5. Am I wrong?

You'd have to pass a repetitions kw. arg to display to change that
dynamically.

form.display(value, **{'.address':{'repetitions':3}})

However, I'm not very happy with the Repeaters implementation... the
max_repetitions parameter shouldn't even exist and it's true that it
should be a little smarter and adjust itself to the length of available
data...

Currently it creates all repeated fields statically (that's the reason for
max_repetitions)... I'm sure something can be done so this happens
dynamically and repeated widgets are created on-demand (lowering memory
footprint in exchange for slighty higher execution time). I hope to have
something done regarding this before the first alpha in a couple of weeks.

Alberto


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to