Thanks for clearing up the displaying unique dropdown value code. Anyone have any thoughts on how to take a select variable and display those values from a table in the new url? For instance I am getting None in the bla variable on the index page. After selecting my form and redirecting there.
On Sep 28, 8:47 am, Anthony <abasta...@gmail.com> wrote: > On Wednesday, September 28, 2011 8:16:18 AM UTC-4, Will wrote: > > > for row in ra: > > SA.add(row.color) > > ##ra = db().select(db.aa.color, distinct=True) > > > ##form = SQLFORM.factory(SQLField('color', label='Select a > > service'), requires=IS_IN_DB(db,'aa.color')) > > The above should work, but the 'requires' goes inside Field() -- also, use > Field instead of SQLField (they're the same, but the latter is deprecated). > > Actually, since you've already got a DB table, you can just use SQLFORM() > and specify the specific field you want to show via the 'fields' argument. > If you don't want to write to the DB, specify dbio=False in the > form.accepts(). > > > form = SQLFORM.factory( > > Field('color', requires=IS_IN_SET(SA))) > > if form.accepts(request.vars, session): > > response.flash = 'form accepted' > > redirect(URL('index',vars ={'bla' :request.vars}))##I want to > > take this variable and perform a search and return the values on > > another page for instance index, does anyone see a way to do that? > > I've tried a few different formats > > The value of the 'color' field will be in request.vars.color and > form.vars.color (they should be the same, unless the particular validator > for the field happens to apply a transformation, which is not the case > here). > > Anthony