I figured it out. I wrote the following function:
function submitform()
{
if (!Page_IsValid) {
return false;
}
return sendHPCIMsg();
}
Then I called this on my click event.
<asp:Button ID="formPost" text="Submit" class="btn btn-default" runat="server" CausesValidation="true" OnClientClick="return submitform();" />
Thanks everyone for the help!