Can you provide an example of IS_IN_SET not working so we can fix it? By 
the way, there was a change in IS_IN_SET in trunk and that may have fixed 
your problem.

On Thursday, 1 March 2012 09:05:51 UTC-6, Cliff wrote:
>
> Running 1.99.4 
>
> I have not been able to get the IS_IN_SET validator to work properly. 
> I don't know why this should be. 
>
> When used with SQLFORM to edit a record, the select field refuses to 
> show the current value of the field.  Instead it shows the first value 
> in the list or the zero value for the field. 
>
> So I made an alternative widget.  The code consists of two functions, 
> below. 
>
> If you are having similar problems, feel free to use it. 
>
> The _style definition at the end of the call is there to make sure I 
> was seeing my widget instead of the default.  It is not necessary for 
> the widget to work. 
>
> ############################################################ 
>
> def is_it_selected(current_value, option, multiple): 
>     if len(current_value) == 1 or not multiple: 
>         current_value=current_value[0] 
>         if current_value==option: 
>             out = 'selected' 
>         else: 
>             out = None 
>     else: 
>         if option in current_value: 
>             out='selected' 
>         else: 
>             out=None 
>     return out 
>
> def my_select_widget(field,value): 
>     # diagnostics uncomment to learn 
>     #print 'value' 
>     #print value 
>     #print 'type(value)' 
>     #print type(value) 
>
>     f = str(field) 
>     f_name = f.split('.')[-1] 
>     f_id = f.replace('.', '_') 
>     f_requires = db[request.controller][f_name].requires 
>     the_set = f_requires.theset 
>     the_multiple = f_requires.multiple 
>     option_set = [] 
>     for t in the_set: 
>         is_selected = is_it_selected(value, t, the_multiple) 
>         option_set.append(OPTION(t, _selected = is_selected)) 
>     return SELECT(option_set, _name='status', _id='buckslips_status', 
>          _style='color:red;' 
>     )

Reply via email to