Jump to content
  • 0

Script not working on embeded datapage


AndyCarruthers

Question

We use this code on one of our pages but it doesn't work on the embed page, what do we need to change in the code?

I have read https://howto.caspio.com/deployment/deployment/ and can't see what to change.

The datapage address is https://c0dcl362.caspio.com/dp/bd4270003fc69ba07879465eb6f3 that shows the code working the embeded page is https://womensrefuge.org.nz/about-us/whanau-protect/initialreferral/

Thanks Andy

</div>
<script>
(function() {
var widget, initAddressFinder = function() {
widget = new AddressFinder.Widget(
document.getElementById('InsertRecordClients_Address'),
'JNV4LRA37GUXY6QBWP9T',
'NZ', {
"address_params": {
"post_box": "0"
},
}
);

widget.on('address:select', function(fullAddress, metaData) {
document.getElementById('Clients_Address').value = fullAddress;

});


};

function downloadAddressFinder() {
var script = document.createElement('script');
script.src = 'https://api.addressfinder.io/assets/v3/widget.js';
script.async = true;
script.onload = initAddressFinder;
document.body.appendChild(script);
};

document.addEventListener('DOMContentLoaded', downloadAddressFinder);
})();
</script>
<script>
(function() {
var widget, initAddressFinder = function() {
widget = new AddressFinder.Widget(
document.getElementById('InsertRecordAlternative_address_parent_etc'),
'JNV4LRA37GUXY6QBWP9T',
'NZ', {
"address_params": {
"post_box": "0"
},
}
);

widget.on('address:select', function(fullAddress, metaData) {
document.getElementById('Clients_Address').value = fullAddress;

});


};

function downloadAddressFinder() {
var script = document.createElement('script');
script.src = 'https://api.addressfinder.io/assets/v3/widget.js';
script.async = true;
script.onload = initAddressFinder;
document.body.appendChild(script);
};

document.addEventListener('DOMContentLoaded', downloadAddressFinder);
})();
</script>
 
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
1 hour ago, AndyCarruthers said:
We use this code on one of our pages but it doesn't work on the embed page, what do we need to change in the code?

I have read https://howto.caspio.com/deployment/deployment/ and can't see what to change.

The datapage address is https://c0dcl362.caspio.com/dp/bd4270003fc69ba07879465eb6f3 that shows the code working the embeded page is https://womensrefuge.org.nz/about-us/whanau-protect/initialreferral/

Thanks Andy

</div>
<script>
(function() {
var widget, initAddressFinder = function() {
widget = new AddressFinder.Widget(
document.getElementById('InsertRecordClients_Address'),
'JNV4LRA37GUXY6QBWP9T',
'NZ', {
"address_params": {
"post_box": "0"
},
}
);

widget.on('address:select', function(fullAddress, metaData) {
document.getElementById('Clients_Address').value = fullAddress;

});


};

function downloadAddressFinder() {
var script = document.createElement('script');
script.src = 'https://api.addressfinder.io/assets/v3/widget.js';
script.async = true;
script.onload = initAddressFinder;
document.body.appendChild(script);
};

document.addEventListener('DOMContentLoaded', downloadAddressFinder);
})();
</script>
<script>
(function() {
var widget, initAddressFinder = function() {
widget = new AddressFinder.Widget(
document.getElementById('InsertRecordAlternative_address_parent_etc'),
'JNV4LRA37GUXY6QBWP9T',
'NZ', {
"address_params": {
"post_box": "0"
},
}
);

widget.on('address:select', function(fullAddress, metaData) {
document.getElementById('Clients_Address').value = fullAddress;

});


};

function downloadAddressFinder() {
var script = document.createElement('script');
script.src = 'https://api.addressfinder.io/assets/v3/widget.js';
script.async = true;
script.onload = initAddressFinder;
document.body.appendChild(script);
};

document.addEventListener('DOMContentLoaded', downloadAddressFinder);
})();
</script>
 

I tried putting the Script in the WebPage instead, and this is what I got
image.png.1b31a6f0545ab9caef5e56875e565368.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...