Ok, some progress made. I copied the code from the xform page in the public demo pages and in the Form function I changed the code string formGuid = CurrentPage[XFormProperty] as string; to instead use a reference of the page where my questionnaire is posted. This works fine! The votes are all registered.
The problem now is when I want to see the statistics. I get the error message "ExternalId may not be an empty guid". I assume this has to do with the statistics not being referenced to the same page the form itself is, right? Any ideas of how to fix this?