I’ve got the richtext input working on my form, learning from previous posts which uses the CKEditor.
BUT!!
When I submit a form which has both the richtext editor and plain text fields,
the plain text and richtext end up on a different row in the data collection.
As in the image seen below.
This is the form(below)
This is what I get in the database.
I assume there are two separate submits occurring internally.
I deactivated the built in “submit” function of the button, and manually added
$w(‘#dataset1’).save()
to the “onClick” function of the submit button, but still the same problem persists.
How can I resolve this problem?
Thank you for all who have taken time to read this.
Any help would be appreciated!
The current code.(below)
import wixData from “wix-data”
$w.onReady(function () {
//TODO: write your page related code here…
});
export function button1_click(event, $w) {
//Add your code for this event here:
$w(‘#dataset1’).save()
//Send a blank message to the HTML element. This tells the HTML element you want it to send you its contents
$w(“#html1”).postMessage(" ");
//Receive the message from the HTML element
$w(“#html1”).onMessage((event) => {
//Create an object named “rich” from the data in the rich text editor to insert into the collection
const rich = {
“richtext”: event.data
};
//Insert the “rich” object into the collection
wixData.insert(“new-collection”, rich)
//Log an error if the insert fails
.catch((err) => {
console.log(“error”, err);
});
});
}