To get to know TG I am trying to start writing a blog application. In my
controller I have:
#####
    @expose(template='kid:tblog.BlogEntryController.templates.form')
    def new(self, **kw):
        return dict(modelname = self.modelname,
                    data      = dict(authorID = identity.current.user.id),
                    form      = model_form,
                    page      ='new')

#####

and:
#####
class BlogEntryFields(widgets.WidgetsList):
    author      = widgets.HiddenField()
    date        = widgets.CalendarDateTimePicker(name      = 'date',
                                                 label     = 'Entry Date',
                                                 validator =
validators.DateTimeConverter())
    entryTitle  = widgets.TextField(name = 'entryTitle', label = 'Entry
Title',
                                    validator = validators.NotEmpty)
    entryText   = widgets.TextArea(name = 'entryText', label = 'Blog Entry',
                                   validator = validators.NotEmpty,
                                   rows = 25, cols = 70)
#####

In the kid-file I have:
#####
#${data}#${data['authorID']}#
${form(value = data, action = 'save', submit_text = "Create")}
#####

I use this, because I want that the author of an entry is the logged in
person.

When I look at the source of the generated page, I see that
    #${data}#${data['authorID']}#
is expanded to
    #authorID#1#

But the hidden field becomes:
    <input class="hiddenfield" type="hidden" id="form_author" name="author">

Value is not filled.
The code should become something like:
    author      = widgets.HiddenField(default = <value>)

but how do I retreive the needed value in BlogEntryFields?

-- 
Cecil Westerhof

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