I’m working on a registration form and need help with sending the form data to HubSpot’s endpoint. The form works fine locally but I’m not sure how to properly configure the POST request to submit data to HubSpot’s API. Here’s my current form setup:
@model MyApp.Models.UserRegistrationViewModel
@using MyApp.Models;
@using (Html.BeginForm("RegisterUser", "Registration", FormMethod.Post)) {
<div class="container">
<div class="form-section">
<h2>Registration Form</h2>
<p>Complete the form below to sign up for our service.</p>
<p class="note">* indicates required fields</p>
</div>
<div class="form-group">
<div class="field-label">
@Html.LabelFor(m => m.UserFirstName)
</div>
<div class="field-input">
@Html.TextBoxFor(m => m.UserFirstName)
<span class="required-indicator">*</span>
</div>
<div class="field-label">
@Html.LabelFor(m => m.UserLastName)
</div>
<div class="field-input">
@Html.TextBoxFor(m => m.UserLastName)
<span class="required-indicator">*</span>
</div>
</div>
<div class="submit-section">
<input type="submit" value="Submit Registration" class="btn-primary" />
</div>
</div>
}
What’s the best approach to modify this form so it posts directly to HubSpot’s form submission endpoint?