This thread has been raging for a while and it is confusing me.
Are you talking about this kind of functionality?
In controller:
form = w.TableForm(fields = [w.TextField('userName')])
In template:
${form(attrs=dict(userName=dict(maxlength='12')))}
The attribute readonly might work but i'm not really familiar with
valueless attributes(selected, checked, readonly). I think readonly
is kind of new to non-ms browsers as well. I really never understand
why you would use it either.
PS: By passing the data to the form at display time we can use the
static form and fields over and over without wasting memory and the
processing power to recompile the template repeatedly.
-Ian
On 3/21/07, Gary Doades <[EMAIL PROTECTED]> wrote:
>
> On Mar 21, 10:39 am, Jorge Godoy <[EMAIL PROTECTED]> wrote:
> > Gary Doades <[EMAIL PROTECTED]> writes:
> > > I can't believe that this is not often needed for most real world
> > > applications. What do other people do in this situation?
> >
> > Custom widgets?
> >
> > > It would be very nice if something similar were available in TG or at
> > > least in ToscaWidgets before TG 2.0 is done.
> >
> > You can achieve that with a custom widget today.
> >
>
> Oh, OK, it looks like I will have to create custom widgets for pretty
> much all of them then. I think I'll have a look at the whole widgets
> framework and try to find the best place to put this functionality in
> generically.
>
> Thanks for the advice..
>
> BTW I just had a peek at the Django newforms widgets (fields). It
> seems they had a similar problem. It looks like it was solved by
> creating the form definition statically (like TG) but at runtime the
> user creates an instance of the form. At instance construction the
> form copies its class field attributes into instance fields attributes
> (self.fields) so that they can be modified at runtime without
> affecting any other form instance. This seems to work for statically
> declaring the form but is efficient and flexible at runtime as the
> form "definition" (the list of widgets etc.) is copied to a mutable
> instance.
>
> The TG widgets are somewhat more complex than the Django ones, but I
> might take a look at this.
>
> Thanks,
> Gary.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---