def handleSubmit(actions, data, default_validate=None):
    """Handle a submit."""
    for action in actions:
        if action.submitted():
            errors = action.validate(data)
            if errors is None and default_validate is not None:
                errors = default_validate(action, data)
            return errors, action
    return None, None
