def getWidgetById(form, id):
    """Get a widget by it's rendered DOM element id."""
    name = id.replace('-', '.')
    prefix = form.prefix + form.widgets.prefix
    if not name.startswith(prefix):
        raise ValueError('Name %r must start with prefix %r' % (name, prefix))
    shortName = name[len(prefix):]
    return form.widgets.get(shortName, None)
