Instead of this:

form=FORM(SELECT(organizations,
_name='organization_id',requires=IS_IN_SET(organizations)),INPUT
(_type='submit'))


I would do

ids=[o.id for o in organizations]
names=[o.name for o in organizations]
form=SQLFORM.factory(Field('organizaiton_id',requires=IS_IN_SET
(ids,names)))


On Dec 12, 11:02 am, johntynan <[email protected]> wrote:
> Thank you for your suggestions.
>
> At this point, I am not trying to create a record in the database at
> the same time that I am setting a session variable.
>
> What I would like to do is set session.organization_id (and possibly
> session.organization_name) by way of a selection list.
>
> I am able to get this form to *almost* work, see
> session_organization_id_form here:
>
> http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrive...
>
> and
>
> http://code.google.com/p/pledgedrivetracker/source/browse/pledgedrive...
>
> However, what I would like to render is:
>
> <option value="{{=organization.id}}">{{=organization.name}}</option>
>
> For each row in the organization table.
>
> And what I am getting is a dictionary for each row in the organization
> table.
>
> Do you have any suggestions for the syntax I would use to define the
> value and text for each select tag in the form?
>
> On Nov 27, 6:37 pm, mdipierro <[email protected]> wrote:
>
> > ERRATA:
>
> > Do not use crud.form
>
> > use instead
>
> > form=SQLFORM(db.table)
> > if FORM.accepts(form,request.vars):
> >     session.form_vars=form.vars
>
> > On Nov 27, 7:36 pm, mdipierro <[email protected]> wrote:
>
> > > Do not use crud.form
>
> > > use instead
>
> > > form=SQLFORM(db.table)
> > > if FORM.accepts(form,request.vars):
> > >     session.form_vars=request.vars
>
> > > On Nov 27, 6:30 pm,johntynan<[email protected]> wrote:
>
> > > > I have a question about saving the values from a crud form as session
> > > > variables (as opposed to updating a record in the database).
>
> > > > Do you know where there might be a good example for doing this?
>
> > > > To get started, I riffed off of the thread here:
>
> > > >http://groups.google.com/group/web2py/browse_thread/thread/5343d94b45...
>
> > > > And then modified the class set_cookies()  that I had started in
> > > > controllers/default.py
>
> > > > here:
>
> > > >http://code.google.com/p/django-pledgedrive/source/browse/trunk/pledg...
>
> > > > and in the simple session_form.html here:
>
> > > >http://code.google.com/p/django-pledgedrive/source/browse/trunk/pledg...
>
> > > > Thanks for any suggestions you might have!
>
> > > > John T.
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en.


Reply via email to