dynamic set your default value:
class Edit:
def GET(self, name):
#query db for content associated with "name"
f = register_form()
*f.get('username').value=your value from db*
return render.register(f)
On Thu, Dec 25, 2008 at 9:26 AM, adelevie <[email protected]> wrote:
>
> Thanks for the response. But how can I change this value dynamically?
> ie, I want the default value to be different depending on which
> database entry is selected based on user input.
>
> class Edit:
> def GET(self, name):
> #query db for content associated with "name"
> f = register_form()
> return render.register(f)
>
> Is there some way for me to pass the default value associated with
> "name" to the template?
>
> -Alan
>
>
> On Dec 24, 9:05 am, FHSM <[email protected]> wrote:
> > value="your default"
> >
> > In the context of the form from the docs it would be:
> >
> > register_form = form.Form(
> > form.Textbox("username", description="Username", value="YOUR
> > DEFAULT VALUE"),
> > )
> >
> > On Dec 23, 11:58 pm, adelevie <[email protected]> wrote:
> >
> > > Is there a way, using the web.form module to dynamically set the
> > > default value for for fields? For example, I want to allow users to
> > > edit entries from a database. When the entry is retrieved I want to
> > > output a form with a textarea (or textbox) with "value=" set to the
> > > current value of that database entry.
> >
> > > Thanks,
> > > Alan
> >
> >
> >
>
--
Su zhaohui 苏召辉
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---