Forms Api: Error sorting and required Legal Consent
Hi there,
for our customer we developed a form on their website and we use the Forms Api to submit contact data to the HubSpot Form.
I noticed two things and perhaps you can help me with this.
Most of the fields are required. If I send an empty form it will result in REQUIRED_FIELD errors for all these fields, but in a seemingly random order. In the form I have this order: first name, last name, email, phone In the result this order: phone, last name, email, first name
Is there a way to sort these errors? In our form we only show the first occuring error to the customer, so this order is confusing.
A more pressing concern is the legal consent. We submit our data like it is described in the documentation:
var data = {
"fields": [
{
"name": "email",
"value": "example@example.com"
},
{
"name": "firstname",
"value": "Jeff"
}
],
"legalConsentOptions":{ // Include this object when GDPR options are enabled
"consent":{
"consentToProcess":true,
"text":"I agree to allow Example Company to store and process my personal data."
}
}
}
If the user does not give his consent (`consentToProcess = false`) it will correctly result in the error MISSING_PROCESSING_CONSENT. BUT if I manipulate the request and delete the whole legalConsentOptions block then the request will be successful, even though the user did not give his consent and although this is required in the form. Why is this? Is there anouther check I'm missing? Do we submit the data wrong?