Partly answering my own question... I'm still not sure about combining
FormFieldRepeater and sprox. But by simply following the example for a
ToscaWidgets form: 
http://www.turbogears.org/2.1/docs/main/ToscaWidgets/forms.html
and using the example of a FormFieldRepeater in samples.py, I was able
to generate the form.  I just had to add a bit of code to the method
that saves the data, to assemble a list of subsample model objects and
put them into the sample.

On Aug 1, 10:56 am, MHCPU <[email protected]> wrote:
> I have a simple model with two tables, call them "sample" and
> "subsample".  Each sample has one or more subsamples (typically two to
> ten subsamples).  I need to display a form with the fields for a
> sample, and up to ten sets of the subsample fields, and insert the
> sample and subsample data into the database when the form is
> submitted.
>
> It looks like tw.forms.FormFieldRepeater would handle generating
> subsample section of the form. But I' not sure if FormFieldRepeater is
> compatible with using sprox. According to the example in tw/forms/
> samples.py, the form that uses FormFieldRepeater needs to be
> subclassed from ListForm, and must contain a "fields" class...
>
> class SampleForm(ListForm):
>     class fields(WidgetsList):
>         ...
>         subsample = FormFieldRepeater(
>             widget = SubsampleFieldset(),
>         ...
>
> whereas to use the form with sprox, the form needs to be subclassed
> from AddRecordForm, and not contain a fields class...
>
> class SampleForm(AddRecordForm):
>     subsample = ???
>
> Can I use FormFieldRepeater and sprox together? If not, any guidance
> on generating repeated sets of fields would be appreciated.

-- 
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