'Method to resolve this form element against the calling resource.
@param resource: the resource
@return: a tuple
subtable alias (or None for main table),
original field name,
Field instance for the form renderer'

def resolve(self, resource):

    from s3query import S3ResourceField
    rfield = S3ResourceField(resource, self.selector)
    field = rfield.field
    if (field is None):
        raise SyntaxError(('Invalid    selector:    %s' % self.selector))
    tname = rfield.tname
    options = self.options
    label = options.get('label', DEFAULT)
    widget = options.get('widget', DEFAULT)
    if resource._alias:
        tablename = resource._alias
    else:
        tablename = resource.tablename
    if (tname == tablename):
        if (label is not DEFAULT):
            field.label = label
        if (widget is not DEFAULT):
            field.widget = widget
        return (None, field.name, field)
    else:
        components = resource.components
        subtables = {}
        if components:
            for (alias, component) in components.items():
                if component.multiple:
                    continue
                if component._alias:
                    tablename = component._alias
                else:
                    tablename = component.tablename
                subtables[tablename] = alias
        if (tname in subtables):
            alias = subtables[tname]
            name = ('sub_%s_%s' % (alias, rfield.fname))
            renamed_field = self._rename_field(field, name, label=label, widget=widget)
            return (alias, field.name, renamed_field)
        raise SyntaxError(('Invalid    subtable:    %s' % tname))
