IS_IN_SET(getFamilies(form.vars.Segment))))
should be
IS_IN_SET(getFamilies(request.vars.Segment))))
but I would not set this validator in models, I would set it in controller
function, where needed.
On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>
> Okay, I want to make the second field of a SQLFORM.factory depend on what
> is chosen in the first field... something like this...
>
> form = SQLFORM.factory(
> Field('PN', requires=IS_NOT_EMPTY()),
> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
> Field('Family',
> requires=IS_IN_SET(getFamilies(form.vars.Segment))))
> ...
>
> Of course I can't use form.vars.Segment until the form is submitted, so
> how can I accomplish this?
>
> So that the field 'Family' takes the value of the field 'Segment', does a
> calculation and returns the appropriate list of families.
>
> I'm super new to web programming, so I apologize in advance if this is a
> dumb question.
>
>
>
>
>
On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>
> Okay, I want to make the second field of a SQLFORM.factory depend on what
> is chosen in the first field... something like this...
>
> form = SQLFORM.factory(
> Field('PN', requires=IS_NOT_EMPTY()),
> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
> Field('Family',
> requires=IS_IN_SET(getFamilies(form.vars.Segment))))
> ...
>
> Of course I can't use form.vars.Segment until the form is submitted, so
> how can I accomplish this?
>
> So that the field 'Family' takes the value of the field 'Segment', does a
> calculation and returns the appropriate list of families.
>
> I'm super new to web programming, so I apologize in advance if this is a
> dumb question.
>
>
>
>
>