cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Full registration with address data and validation (API)

dschattenberg
Explorer
0 Kudos
640

Hi experts,

In the UI builder I'm creating a Full registration screen with address data. This screen should replace the current webservice form for a account registration. However, in this current registration the customer has added an address validation API. When the postal code and housenumber is filled the API will search for the correct address.

Is such setup also possible with CDC? And how could this be configurated?

Kind regards,

Daan

Accepted Solutions (0)

Answers (1)

Answers (1)

gourav63875
Explorer

Hi dschattenberg

As I understand you want to hit a address validation API in registration screen set. what you need to do is add a fetch request on change of your field in screen set JavaScript. I am adding some reference code for you.

if(event.screen === 'Registration' && event.field === 'profile.zip'){

var requestOptions = { method: 'GET', redirect: 'follow' };

fetch("API_URL?codes="+zipcode+"&country=US", requestOptions)

.then(function(response){

response.json();

}).then(function(result){

// here your action on success Or depends on your API

console.log(result);

})

.catch(function(error){console.log('error', error);});

}

I think this will help you.

SebastianSchuck19
Active Participant
0 Kudos

If you want to be very strict about address validation, setup an OnBeforeAccountsRegister extension to validate the user's address server-side. Then adjust the Screensets event logic to handle your extensions error responses. For a better user experience still add client side validation up-front as suggested in this response.

Best,

Sebastian Schuck

Rvanjari
Participant
0 Kudos

Hi Gourav ,

if we use this java script to get the details how to set the response to the Screen-set? In my case want to pass address details retrieved (response) based on the postcode back to registration form.

Many Thanks,

Ruchita