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