I’m currently trying to save the rich text input box to my cms database. Whenever I try external things such as make or zapier, it never pulls the information from the rich text box, but everything else. I want it so that when I submit the form, the rich text and everything else’s data is saved. please help
Here is my code for the inside tag:
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<script>
var Webflow = Webflow || [];
Webflow.push(function() {
// display error message
function displayError(message) {
hideLoading();
failureMessage.innerText = message;
failureMessage.style.display = 'block';
}
// hiding the loading indicator
function hideLoading() {
showForm();
successMessage.style.display = 'none';
}
// hide the form
function hideForm() {
form.style.display = 'none';
}
// show the loading indicator
function showLoading() {
hideForm();
successMessage.style.display = 'block';
}
// show the form
function showForm() {
form.style.display = 'block';
}
// listen for xhr events
function addListeners(xhr) {
xhr.addEventListener('loadstart', showLoading);
}
// add xhr settings
function addSettings(xhr) {
xhr.timeout = requestTimeout;
}
// triggered form submit
function triggerSubmit(event) {
// prevent default behavior form submit behavior
event.preventDefault();
// setup + send xhr request
let formData = new FormData(event.target);
let xhr = new XMLHttpRequest();
xhr.open('POST', event.srcElement.action);
addListeners(xhr);
addSettings(xhr);
xhr.send(formData);
// capture xhr response
xhr.onload = function() {
if (xhr.status === 302) {
let data = JSON.parse(xhr.responseText);
window.location.assign(event.srcElement.dataset.redirect + data.slug);
} else {
displayError(errorMessage);
}
}
// capture xhr request timeout
xhr.ontimeout = function() {
displayError(errorMessageTimedOut);
}
}
// replace with your form ID
const form = document.getElementById('post-form');
// set the Webflow Error Message Div Block ID to 'error-message'
let failureMessage = document.getElementById('error-message');
// set the Webflow Success Message Div Block ID to 'success-message'
let successMessage = document.getElementById('success-message');
// set request timeout in milliseconds (1000ms = 1second)
let requestTimeout = 10000;
// error messages
let errorMessageTimedOut = 'Oops! Seems this timed out. Please try again.';
let errorMessage = 'Oops! Something went wrong. Please try again.';
// capture form submit
form.addEventListener('submit', triggerSubmit);
});
</script>
And here is my code for the before tag
<script>
var Webflow = Webflow || [];
Webflow.push(function() {
$(document).on('submit', 'form', function() {
setTimeout(function() { location.reload(true); }, 3000);
});
});
</script>
<!-- Include the Quill library -->
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<!-- Initialize Quill editor -->
<script>
var quill = new Quill('#editor', {
modules: {
toolbar: [
[{ 'header': [2, 3, 4, 5, 6, false] }],
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block', 'link'],
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
['clean']
]
},
placeholder: 'You can start typing here...',
theme: 'snow'
});
var form = document.querySelector('#post-form');
form.onsubmit = function() {
// Populate hidden form on submit
var about = document.querySelector('textarea[name=Journal]');
about.value = quill.root.innerHTML;
console.log("Submitted", $(form).serialize(), $(form).serializeArray());
// No back end to actually submit to!
return false;
};
</script>
If necessary, my ID for the rich text box is ‘editor’.
The form id is email-form.
Currently while using the make integration webhook and I make a sample entry to see the data, this it what I see:
The description area should have my rte input from the form but it is missing.
Here is my public share link: LINK
(how to access public share link)