Hi,
So I implemented a rich text editor on a form page along with dropdown menus / text inputs etc. so the user can submit pulic data (like on a forum).
However there’s (apprently) no way to connect any element to the database when there’s a rich text editor, since all the data is sent through a bit of code.
gI would like the user to be redirected to the pae he created after he successfully submitted his data (like the option allows with the wix data).
Here’s my code:
import wixData from "wix-data";
$w.onReady(function () {
$w("#dataset1").onReady(() => {
const msg = $w("#dataset1").getCurrentItem();
$w("#html1").onMessage((event) => {
if (event.data === "ready") {
$w("#html1").postMessage(msg.longDescription);
}
});
$w("#html1").onMessage((event) => {
//Set the value for the rich text field of the dataset's
//current item to be the data in the HTML element
const dataWithFixedLinkStyles = event.data.replace(/\<a/g, `<a style="color:#3D9BE9;"`);
$w('#dataset1').setFieldValue("descriptionDeal", dataWithFixedLinkStyles);
$w("#dataset1").save()
.then((res) => {
});
});
});
});
export function button15_click_1(event, $w) {
//Send a blank message to the HTML element. This tells the HTML
//element you want it to send you its contents
$w("#html1").postMessage("save");
//Receive the message from the HTML element
}
Many thanks !