> ## Documentation Index
> Fetch the complete documentation index at: https://developer.dromo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Validating Multiple Rows at Once

Row hooks are great for validating a single row, but what if you want to validate multiple rows at once? For example, you want to make sure that the user has imported at least 20 rows. In this case, you can use the beforeFinish callback.

This function will run every time the user clicks the "Finish" button. If it returns an object with the `cancel` property set to `true`, the user will be reverted to the data review screen, and the `message` will be displayed as a table-level error.

<Info>
  For more information on the beforeFinish callback, see the [Reference](/reference/results#the-beforefinish-callback) documentation.
</Info>

<CodeGroup>
  ```javascript JavaScript theme={null}
  dromo.beforeFinish(function (data, metadata, instance) {
    if (data.length < 20) {
      return { cancel: true, message: "You must import at least 20 rows" }
    }
  });
  ```

  ```jsx React theme={null}
  <DromoUploader
    ...
    beforeFinish={(data, metadata, instance) => {
      if (data.length < 20) {
        return { cancel: true, message: "You must import at least 20 rows" }
      }
    }}>
    Launch Dromo
  </DromoUploader>
  ```
</CodeGroup>
