>
> @auth.requires_login()
> def repair():
> ## TODO Need to add a way to find the bike_identifier.
> ## For now, just get the first bike listed.
> record = db(db.bike.bike_identifier != "").select()[0]
> assert(record != None)
> form = SQLFORM(db.bike, record, showid=False)
> # Default a form value
> #form.vars.bike_identifier = record.bike_identifier
> form.add_button("Cancel", URL("index"))
> *form.add_button("Print_Tag", URL("tagprint", args=form.vars.
> bike_identifier))
> * form.process() #onvalidation=onValidate)
>
First, when the form is first created, there are no request.vars and
therefore no form.vars, so form.vars.bike_identifier will be None. Second,
even once the form is submitted and there are some request.vars, form.vars
will not be filled in until after you call form.process(), so
form.vars.bike_identifier will still be None at the point where you are
accessing it.
Perhaps instead you want:
form.add_button("Print_Tag", URL("tagprint", args=record.bike_identifier))
Anthony
--