I’m trying to realize an indexhandler. Now I can click on a field in HTML and a second window appears. Then, by clicking one of several buttons on the second page, a value gets returned in the field of the first window. This works like this:
self.opener.document.getElementById('idOfFieldOnWindow1').value = 'myValue';
The value here “myValue” gets read out of a database by php. This value can also be a text with more than one lines (it contains at least one or more linebreaks). If I write these values in the code, it gives me a JavaScript Exception:
ERROR: unterminated string literal
setValue("Text on which a linebreak follows
How can I solve this that I can return the value so it gets shown in the first field including linebreaks?
You need to turn your actual line break “\n” into a Javascript text that will produce a line break “\\n”.