hof 21.2.0-postcode-lookup-beta.2 → 21.2.0-postcode-lookup-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -279,7 +279,7 @@ module.exports = config => {
|
|
|
279
279
|
// Clear the value stored in the addresses radio button group
|
|
280
280
|
req.sessionModel.set(`${addressFieldNamePrefix}-select`, '');
|
|
281
281
|
// Replace punctuation in postcode and call OS Places API to return list of addresses
|
|
282
|
-
const enteredPostcode = req.
|
|
282
|
+
const enteredPostcode = req.form.values[`${addressFieldNamePrefix}-postcode`]?.replace(/[^\w]+/g, "").replace(/^(.*)(\d)/, "$1 $2");
|
|
283
283
|
|
|
284
284
|
await PostcodeLookup(enteredPostcode, apiURL, apiKey)
|
|
285
285
|
.then(function (response) {
|
|
@@ -180,7 +180,7 @@ module.exports = Validators = {
|
|
|
180
180
|
|
|
181
181
|
postcodeValidation(value) {
|
|
182
182
|
// eslint-disable-next-line max-len
|
|
183
|
-
return Validators.regex(value, /^(([GIRgir] ?[ ]*0[ ]*[Aa]{2}[ ]*)|((([A-Za-z][ ]*[0-9]{1,2}[ ]*)|(([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9][ ]*[0-9]?)[ ]*|(([A-Za-z][ ]*[0-9][ ]*[A-Za-z][ ]*)|([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9]?[ ]*[A-Za-z][ ]*))))[^\w]
|
|
183
|
+
return Validators.regex(value, /^(([GIRgir] ?[ ]*0[ ]*[Aa]{2}[ ]*)|((([A-Za-z][ ]*[0-9]{1,2}[ ]*)|(([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9][ ]*[0-9]?)[ ]*|(([A-Za-z][ ]*[0-9][ ]*[A-Za-z][ ]*)|([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9]?[ ]*[A-Za-z][ ]*))))[^\w]*?[ ]*[0-9][ ]*[A-Za-z][ ]*[A-Za-z][ ]*))$/);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
};
|