'Widget builder
@param field: the Field
@param value: the current value
@param attributes: the HTML attributes for the widget'

def __call__(self, field, value, **attr):

    selector = attr.get('id')
    if (not selector):
        if isinstance(field, Field):
            selector = str(field).replace('.', '_')
        else:
            selector = field.name.replace('.', '_')
    name = attr.get('_name')
    if (not name):
        name = field.name
    T = current.T
    request = current.request
    s3 = current.response.s3
    real_input = INPUT(_id=selector, _name=name, _value=value, _type='hidden')
    formstyle = s3.crud.formstyle
    if (value is None):
        value = '{}'
    value = eval(value)
    type_options = (('string', 'String'), ('integer', 'Integer'), ('float', 'Float'), ('text', 'Text'), ('object', 'Object'), ('date', 'Date'), ('time', 'Time'), ('datetime', 'DateTime'), ('reference', 'Reference'), ('location', 'Location'))
    type_id = ('%s_type' % selector)
    select_field = Field('type', requires=IS_IN_SET(type_options))
    select_value = value.get('type', '')
    select_field.tablename = 'dc_question_model'
    select = OptionsWidget.widget(select_field, select_value)
    multiple = value.get('multiple', False)
    if (multiple == 'true'):
        multiple = True
    else:
        multiple = False
    is_required = value.get('is_required', False)
    if (is_required == 'true'):
        is_required = True
    else:
        is_required = False
    components = {}
    manual_input = self._input
    components['type'] = ('Type:    ', select, type_id)
    components['is_required'] = manual_input(selector, 'is_required', is_required, T('Is    Required'), 'checkbox')
    components['description'] = manual_input(selector, 'description', value.get('description', ''), T('Description'))
    components['default_answer'] = manual_input(selector, 'defaultanswer', value.get('defaultanswer', ''), T('Default    Answer'))
    components['max'] = manual_input(selector, 'max', value.get('max', ''), T('Maximum'))
    components['min'] = manual_input(selector, 'min', value.get('min', ''), T('Minimum'))
    components['filter'] = manual_input(selector, 'filter', value.get('filter', ''), T('Filter'))
    components['reference'] = manual_input(selector, 'reference', value.get('reference', ''), T('Reference'))
    components['represent'] = manual_input(selector, 'represent', value.get('represent', ''), T('Represent'))
    components['location'] = manual_input(selector, 'location', value.get('location', '[]'), T('Location    Fields'))
    components['options'] = manual_input(selector, 'options', value.get('options', '[]'), T('Options'))
    components['multiple'] = manual_input(selector, 'multiple', multiple, T('Multiple    Options'), 'checkbox')
    scripts = s3.scripts
    script_dir = ('/%s/static/scripts' % request.application)
    script = ('%s/S3/s3.ui.question.js' % script_dir)
    if (script not in scripts):
        scripts.append(script)
    script = ("$('#%(widget_id)s').addQuestion()" % {'widget_id': 'dc_question_model'})
    s3.jquery_ready.append(script)
    visible_components = self._layout(components)
    return TAG[''](real_input, visible_components)
