Respond after entering an n8n form trigger

Describe the problem/error/question

I would like to use n8n forms to respond dynamically (relative to the form)
To do this I indicate “Respond To Webhook node” in “response when” of the form.
In the Respond To Webhook node, I configure JSON, I put a “formSubmittedText” key
It works correctly.
But I would like to skip a line in the text, like:
line 1
line 2

Is it possible ?

I have tried many possible schemes without success.

Another solution is to send to a url (in the configuration of the n8n form node), in this case can n8n generate html (the answer is yes I think) but can it manage its display on url?

Please share your workflow

Information on your n8n setup

  • n8n version:1.27.3
  • **Database (default: SQLite): no **
  • n8n EXECUTIONS_PROCESS setting (default: own, main): ?
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system:linux

Hey @leov66,

If you wanted to skip some lines you would need to handle that in your Code node which is giving you the formatted text but it really does depend on what you want to skip.

I tried several combinations:
I separate my lines with “\n” but there was no line break but only the character ‘\n’
I separate my lines with “
” same problem
I create a list with one row per item

but each of these attempts was not a success

Hey @leov66,

Can you explain in more detail what you actually want to skip maybe provide an input and what you expect the output to be?

Hi Jon,

I’m setting up the form to allow responding with a “Webhook response”:

In the “Webhook Response” node, I’m using an output JSON with the “formSubmittedText” field. I’ve tried various methods to include line breaks in the output text, but none have been successful.

After looking around a bit in the response page inspection, I see the following piece of code:

if (useResponseData === "true") {
	const text = await response.text();
	let json;

		json = JSON.parse(text);
	} catch (e) {}

	if (json?.redirectURL) {
		const url = json.redirectURL.includes("://") ? json.redirectURL : "https://" + json.redirectURL;
	} else if (json?.formSubmittedText) { = 'none';
		document.querySelector('#submitted-form').style.display = 'block';
		document.querySelector('#submitted-content').textContent = json.formSubmittedText;
	} else {
		document.body.innerHTML = text;

I’m not very proficient in JavaScript, but the statement:
document.querySelector('#submitted-content').textContent = json.formSubmittedText;
Seems to interpret the content of formSubmittedText as plain text without possible line breaks. Would changing ‘textContent’ to ‘innerHTML’ possibly resolve the issue?
Here’s the code I envision:

// Replacing line breaks with <br> tags
text = text.replace(/\n/g, "<br>");

// Inserting the text into the paragraph using innerHTML
document.querySelector('#submitted-content').innerHTML = text;

I don’t know if the workflow you have posted is the latest, but I’ve noticed there are mistakes the way you compose the string in the python script
separator = ",\"<br>\",\"" ← this for example is not a valid string
In general I would advice to take advantage of the json load/dumps python standard library for serializing and deserializing from a string

It’s not the latest version, that’s correct.
This is one of the attempts I made, but the JSON content is necessarily treated as text (see the message above)
I have the impression that the HTML page is retrieved from the n8n server so I have no control over it.

If I was wrong in my analysis, don’t hesitate to tell me!