To make Form field auto fill page url like this
You can follow these
#1. Edit Form Block > Add a Text Field
Name: Page URL
Placeholder: Page URL
#2. Use this code to Code Injection > Footer
<script>
window.addEventListener("load", (event) => {
const formBlocks = document.querySelectorAll('.sqs-block-form');
const triggerInputChange = (inputElement, value) => {
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
window.HTMLInputElement.prototype,
"value"
).set;
nativeInputValueSetter.call(inputElement, value);
const inputEvent = new Event("input", { bubbles: true });
inputElement.dispatchEvent(inputEvent);
}
formBlocks.forEach((block) => {
const timestamp = location.pathname;
const subjectInput = block.querySelector('[placeholder="Page URL"]');
if (subjectInput) {
const subjectField = subjectInput.closest('.form-item');
subjectField.hidden = true;
triggerInputChange(subjectInput, timestamp)
}
})
});
</script>
#3. Result