'Return FormDefinition created from an xml element.'

def from_elem(self, elem, layout=None):

    name = elem.get('name')
    label = elem.get('label')
    required = string_as_bool(elem.get('required', 'false'))
    default = elem.get('value')
    helptext = elem.get('helptext')
    visible = string_as_bool(elem.get('visible', 'true'))
    field_layout = elem.get('layout', None)
    if field_layout:
        assert (layout and (field_layout in layout)), ('Invalid    layout    specified:    %s    not    in    %s' % (field_layout, layout))
        field_layout = str(layout.index(field_layout))
    return self.new(name=name, label=label, required=required, helptext=helptext, default=default, visible=visible, layout=field_layout)
