VONQ
ChangelogVersion 4.9

Empty optional fields are sent as null, and fixed Posting Details errors clear

Empty optional fields are sent as null, and fixed Posting Details errors clear

Empty optional fields

With loose validation, a field such as Address Line 1 can be optional. The order journey shows it as optional and sends loose=true, but an empty field was still sent as an empty string (""). The API treats "" as a value and rejected it with "This value should not be blank.", so a Job Post order could not be placed without filling in the optional field.

Errors on the Posting Details page

The Posting Details page groups several steps. When the last of them (Working Location) had an error from the API, correcting the field and clicking Next did not validate that step again: the error stayed, the page did not advance, and going back and forward did not clear it.

What changed

  • Empty optional fields: when loose=true is sent, a field that is optional for the current basket and holds only whitespace or invisible characters (such as a zero-width space from pasted text), or nothing at all, is sent as null. This applies to ordering, editing and validating a campaign, including direct calls to hapi.campaign.api.orderCampaign, validateCampaign and saveCampaign with loose: true. A field with a value is sent as typed, and requests without loose=true are unchanged.
  • Grouped steps: clicking Next validates every step of the page again, including one that shows errors from the API. A corrected field loses its error. The journey moves on once no step of the page has an error left.
  • Step errors: each step replaces its own errors with the latest result and keeps the errors of other steps. This includes salary range errors.