I request this feature in wix code!
I want to add an trustpilot Product reviews box to my dynamic page... But i need to use your HTML editor to sync between trustpilot and my site.. But at the moment i can't connect HTML editor to database in wix code...
How i think it should work:
1: In wix database:
Add field - in field type choose HTML - enter the html code here
2: On dynamic page
add the HTML editor - connect it to wix database and choose the HTML code field
I'm trying to do the same thing. I'm almost there, but now when I try to pass a value, Wix tells me:
"Wix code SDK error: The message parameter that is passed to the postMessage method cannot be set to the value . It must be of type object,string."
So my next question is, how do I set a value passed from the database to an object that I can then pass to the HTML component??
Here's what I have so far:
$w.onReady(function () {
$w("#dynamicDataset").onReady(function(){
var payPal = $w('#dynamicDataset').getCurrentItem().payPalCode;
$w("#payPalCode").postMessage(payPal);
});
});
Within the HTML component I have the following:
<!doctype html>
<html>
<head>
<script type="text/javascript">
function init () {
// when a message is received from the page code
window.onmessage = (event) => {
if (event.data) {
console.log("HTML Code Element received a message!");
insertMessage(event.data);
}
}
}
// display received message
function insertMessage(msg) {
document.getElementById('code').innerHTML = msg;
sendReturnMessage("Message from the HTML Component!");
}
// send message to the page code
function sendReturnMessage(msg) {
window.parent.postMessage(msg, "*");
}
</script>
</head>
<body onload="init();">
<div id="code">Code goes here</div>
</body>
</html>
I have this same doubt, since in case I can connect it to the html box, a code in the database would help to put Wight from the IMDB site and others as my system of Votes Per Star:
That in the final result should look something like this:
Hi,
I'm trying to do something similar, i.e. putting htlm in database, and then embed iframe of htlm code in a dynamic page, with would change from one page to the next.
If you ever find a solution, please tell me, it would be fantastic.
Are there any wix experts seeing this? :)
Would be awesome to know if it's something you're working on? - And would be a great feature
Please let me know any updates
Hello, i do have same problem! I need to connect my wix html container to my database, but wix doesn't give me this option.
Hello mattias, did you find a solution?
Can a wix expert give a comment on this feature request please?
Simple solution by @Giri Zano https://www.wix.com/corvid/forum/main/comment/5a033500a945a80014202c90