The following code generates an image link when it is loaded on a button, I would like an error to appear when an image is not loaded on the button. I have the following code that validates, but it doesn't work.
export function text68_viewportEnter(event) {
const item = $w("#dataset2").getCurrentItem();
const wiximageurl = "https://static.wixstatic.com/media/";
let image1local = "";
image1local = item.payStub1.replace('image://v1/', '');
image1local = image1local.substr(image1local.lastIndexOf('/')+1);
const image1Url = wiximageurl + image1local;
image1Url.onCustomValidation( (value, reject) => {
if (wiximageurl + image1local(value)) {
reject(`image1Url is not a url`);
image1Url.value = "";
}
});
i want to upload an image of a button but i am getting error. No what should i do!