Extend validate on submit to allow validation with schema

def validate_on_submit(self):
        """ Extend validate on submit to allow validation with schema """

        # validate form
        valid = FlaskWtf.validate_on_submit(self)

        # return in case no schema or not submitted
        if not self._schema or not self.is_submitted():
            return valid

        # validate data with schema if got one and form was submitted
        data = dict()
        for field in self._fields:
            data[field] = self._fields[field].data

        result = self.schema.process(data, context=self._force_context)
        self.set_errors(result)

        # set filtered data back to form
        for field in data:
            self._fields[field].data = data[field]

        return valid and not bool(self.errors)