> > I'd like to do something like
> > add_people_form['lastname'].default='the lastname that we have guessed'I
> > usually do this:
>
> params = {'value':{'lastname':'blabla'}}
>
> then I pass form=TheFormClass.form and params=params to the template,
> and display everything with form(**params)
>
> params can also contain options to be send down to Select widgets,
> repetitions number for Repetition widgets, and the like
>
> Or, you could directly use form(value=value) if you have no need for
> such options (but I bet you will)
great .. so this is the way of doing it !
> > so how can I do to touch the:
> > - default : so I can put a text in the textfieldThe 'default' for widgets,
> > is called 'value' in the case of forms, as
> I've shown you above. This is used when the form is first displayed.
> *If* there are validation errors upon submitting, the values redisplayed
> are taken from the request (==the submitted values), so the 'value'
> parameter is not used anymore.
clear... really clear !
> > - attrs : that I can change for e.g. the sizeThe attrs for widgets are
> > usually specified inside the Field class, for
> each widget. Just use attrs={'size':...., 'maxlength': ....}
>
> The attrs for TableForm can, likewise, be passed to the TableForm
> constructor.
mmh ? yeah this is what I usually do. But this time I was wanting to
disable a field. And I've been doing it with :
add_people_form.field_for('lastname').attrs['disabled']='true'
in the controllers.py without knowing if its a good way to do it like
this ?
> > thanks in advance for your helpHope I was precise enough> Ced.
> > P.-S. does someone has a good reference for such things.The printed book is
> > quite good, but it doesn't contain every recipe.
> More can be found on the wiki, I suppose.
>
> There are many ways to operate forms, widgets, validators... it boils
> down to (meta)classes and passing of dictionaries... so the best thing
> would be to understand the base concepts. Try writing a few forms, then
> take a look to widgets/forms.py to understand more of it.
I've been browsing this ! But it's quite hard to get it !
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---