How to add html web embed from dynamic dataset

Hi all, I hope someone can help me as it’s baffling my poor little brain.

I have created a dynamic page to display lots of pieces of information from a database filled with information collected on a user input form. I would like to display the inputted web address from this database as a web embed, with the url pulled from the database.

I am using the below code with dataset1 being linked to the profile database, and html1 is the web embed element.

$w.onReady( () => {
$w(“#dataset1”).onReady( () => {
const itemUrl = $w(‘#dataset1’).getCurrentItem().url;
$w(‘#html1’).src = itemUrl;

} );

} );

I am getting an error code:

Wix code SDK error: The url parameter that is passed to the src method cannot be set to the value . It must be of type url.

Can someone please help me understand where I am going wrong and help me fix this issue? Thanks!

Are you sure you are handing a DB-type “URL” to the function? URL´s MUST have a protocol identifier (like https:// ) in Wix. Just console.log the “itemUrl” and see if it is correctly formatted.