I have a custom module which retrieves data from a third-party site (Strava). I have implemented a custom block via hook_block_view() which handles the authorisation dialogue between my user and Strava. This works and retrieves information about the user which I store as a database record. Now I want the user to provide data for some additional fields for this record. I have implemented a form to collect this data. Once the authorisation dialogue is complete I present this form to the user. The form includes a hidden field which contains the key for  the database record.

My problem is how to get the form's validation and submit handlers to run after the user clicks submit. At the moment my custom block code runs. Although this detects the situation and does not run a second authorisation dialogue, the handlers are not invoked.

How should I be implementing this? Do I need to specify a second block which contains just the form?

Thanks in  advance.