Making map selection mandatory on form

We are using the “Map - Find nearest” widget on some of our forms and they have been made mandatory using some code where the submit button is hidden unless a location is selected on the map.
This is the piece of code
if(existingNearestAddress){
document.getElementById(‘nearest_address’).innerHTML = existingNearestAddress;
if (validationMessage) {
validationMessage.hidden = true;
}
} else if (submitButton) {
submitButton.disabled = true;
if (validationMessage) {
validationMessage.hidden = false;
}

We are now building our forms for our portal and are using the subpage Button Cluster Bottom for the next page and submit buttons so this location validation is not working.

Anybody know how I can either change the code or do something in the form to get the location validation to work to force the person completing the form to select a location on the map?