Have you looked at SQLFORM?

http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM

-Jim



On Friday, January 17, 2014 10:55:55 AM UTC-6, Keith Planer wrote:
>
>
> So here's my method as-is right now:
>
> def diagnosis_lookup():
>     ...
>     var=request.args(0)
>     ...
>     if var is not None:
>         query=db((db.diagnosis.consumer_id==request.args(0))).select(
> orderby=~db.diagnosis.id)
>     form = FORM(
>                 TABLE(
>                       TR(
>                          "Diagnosis: ", INPUT(_name='diag')
>                          ),
>                       ...
>                       TR(INPUT(_type='submit'))
>                       )
>                 )
>     if form.accepts(request.vars, session):
>         db.diagnosis.update(
>                             diag_text=form.vars.diag,
>                             ...
>                             consumer_id=request.args(0)
>                             )
>         query = db((db.diagnosis.consumer_id==request.args(0))).select(
> orderby=~db.diagnosis.id)
>     return locals()
>
> What I want to do is bring back whatever is already in the row so the form 
> will be filled out when the page first loads. Or if its a new record, for 
> the form to be blank.
> so I'm under the impression that the form should look something like:
> "Diagnosis: ", INPUT(_name='diag',_value=<db.diagnosis.diag_text>)
> but I haven't found an example of how it should look.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to