UK postode lookup and validation

Hi all,

Im a bit of a newbie to Bubble but im trying to create a form which searches a postode when a button is clicked to save end user time.

I have an API provider for the postcode lookup but each time I set this up through the API connector i cant get it to show the results.

Is there also a way of storing the data once its been collected from the API?

Hope this makes sense. Thank you in advance!

You could save the returned results in a state. So press your button, call the API, get results, put the result in a state of an element, show what is saved in the state.

Does this make sense?

1 Like

Do you mean the validation response to know if the postcode is valid e.g. yes/no?
This can be saved in a custom state on page no problem. Same could be set with the postcode as either text or a geographical location field type, depends what you’ll do with it.

Saving all the postcodes lookup wouldn’t be possible, turns out there are over 1.7m variations :thinking:

If you are just trying to validate a postcode use a regex

^(([gG][iI][rR] {0,}0[aA]{2})|((([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y]?[0-9][0-9]?)|(([a-pr-uwyzA-PR-UWYZ][0-9][a-hjkstuwA-HJKSTUW])|([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y][0-9][abehmnprv-yABEHMNPRV-Y]))) {0,}[0-9][abd-hjlnp-uw-zABD-HJLNP-UW-Z]{2}))$


Thanks everyone, I will try out your suggestions. :+1: