First time post. I set up a database for a site so that the person who takes over after I put their site together can easily add and remove information via database entry. Everything went swimmingly (very easy to set up), but now I note I am getting SDK errors when one loads the page with the dataset in it in a repeater:
Wix code SDK error: The “src” property cannot be set to “”. It must be a valid URL starting with “http://”, “https://”, or “image://”.
I disconnected the image on the repeater from the dataset, and the errors go away in the dev console. I connect it back up, and the errors return (so we know where the trouble is, right?).
I set up a picture field in the database, of type Image, as directed by the instructino video. Can anyone tell me why this then generates these http errors?
Hi Michael,
The reason that you get those error messages is because you connect a repeater to a collection, however, there are some records without an image, as you can see here:
Oh oh oh! Got it. As mentioned, the site is in flux, but I was bothered by the error messages. Makes perfect sense now that you explain it, Tal. Thank you so much for the insight (as you can see in the dbms, the pics in there are all placeholders, and I just didn’t populate some of them). Cheers!
Hi again, Tal… FOLLOW-UP question then… You know how sometimes not all fields in a DBMS have data in them? They are asking me for an additional page that requires another dataset now. Some of the fields (some pictures in particular) will NOT have data in them, so these SDK errors will get thrown as the page loads (not to the end user, I realize). Is this, in and of itself, a bad thing? I mean, does the throwing of the errors cause any trouble for the end user loading the page???
I was getting a similar error message with a video player. My work-around was
– do not connect the video player to the collection
– collapse the video player on load
– write code that checks to see if there is a video in the collection and, if there is, then load the video player with the video source and expand the player.
It seems like there ought to be a more elegant way to handle a “NULL” value in the data field. Here’s the work-around code. The field that has some NULL values is called “videoUrl”
$w.onReady(() => {
$w(“#dynamicDataset”).onReady(() => { const item = $w(“#dynamicDataset”).getCurrentItem();
// Checks if the current item has a value in the “videoUrl” field if (!item.videoUrl) {
// Collapses the video player if there is no value for “videoUrl”
$w(“#videoPlayer”).collapse();
} else {
$w(“#videoPlayer”).src = item.videoUrl;
$w(“#videoPlayer”).expand();
}
});
The error message I was getting is:
Wix code SDK error: The “src” property cannot be set to “”. It must be a valid image URL starting with “http://”, “https://” or “wix:image://”, or a valid video URL starting with “wix:video://”.