I’m working on a registration form and need help with posting the data to HubSpot’s API endpoint. I have a basic form set up, but I’m not sure how to configure the submit button to send a POST request to the HubSpot URL.
Here’s my current form structure:
@model CompanyPortal.Models.UserRegistrationViewModel
@using CompanyPortal.Models;
@using (Html.BeginForm("RegisterUser", "Registration", new { area = "CompanyPortal" }, FormMethod.Post)) {
<div class="container">
<div class="col-12">
<h2>User Registration Form</h2>
<p>Complete the form below to create your account, or <a href="/contact/support">reach out to our team</a>.</p>
<p class="note"><span class="required">*</span> indicates mandatory fields</p>
</div>
<div class="form-section">
<div class="field-group">
@Html.LabelFor(m => m.GivenName)
</div>
<div class="input-group">
@Html.TextBoxFor(m => m.GivenName)
<span class="required" title="This field is required">*</span>
</div>
<div class="field-group">
@Html.LabelFor(m => m.FamilyName)
</div>
<div class="input-group">
@Html.TextBoxFor(m => m.FamilyName)
<span class="required" title="This field is required">*</span>
</div>
<div class="button-section">
<div class="col-10 offset-1">
<input type="submit" name="submitAction" value="Submit Registration" />
</div>
</div>
</div>
}</div>
What’s the best way to configure this to post directly to HubSpot? Any suggestions would be helpful.