Colour Picker widget for web2py displays multiple

186 views Asked by At

I have installed the color picker widget for web2py.

I am trying to use multiple color pickers in a single form and I am getting unwanted repeats of the widget - 10 on the page instead of 4.

Here is my table definition from model.py

db.define_table('config',
    Field('width', 'decimal(10,6)'),
    Field('height', 'decimal(10,6)'),
    Field('plot_color_1', 'string', widget=color_widget.widget),
    Field('plot_color_2', 'string', widget=color_widget.widget),
    Field('plot_color_3', 'string', widget=color_widget.widget),
    Field('plot_color_4', 'string', widget=color_widget.widget),
    auth.signature,
    migrate=True,
)

Here is controller, config.py

def edit():
    record = db.config(1)
    fields = (
        db.config.id,
        db.config.width,
        db.config.height,
        )
    form = SQLFORM(db.config, record, 
        #fields=fields, 
        showid=False)
    if form.process().accepted:
        response.flash = 'form accepted'
    elif form.errors:
        response.flash = 'form has errors'
    else:
        response.flash = 'please fill out the form'
    return dict(form=form)

And the resulting output.

enter image description here

Can someone suggest a workaround?

0

There are 0 answers