You are not logged in.
I need to alter the behaviour of the creation of the child nodes so that each element has a line return. Currently, Xinha creates one long string of text by using surroundContents() without any line feeds. This results in one long string of HTML output :
<p>this is one line</p><p>this is the next</p></br>linebreak etc
What I want is to force a HTML escape character (
) at the beginning of each child node so that the resulting HTML text is broken into smaller blocks :
<p>this is one line</p>
<p>this is the next</p>
</br>linebreak etc
I need this as I am using Xinha to format HTML email messages and many SMTP servers have rules or use RBLs that block messages with too many characters on one line.
I'm not sure how, in the section that appends the nodes using createElement(newTagName), this might be done.
Can anyone give me some help.
Offline
The simplest method would be for you to insert the linebreaks yourself when the text is submitted to you, eg in php
$text = $_POST['myXinhaField'];
$text = preg_replace('/(<\/[a-z0-9]+>)/i', '$1\r\n', $text);
James Sleeman
Offline
The problem I face is that there are no server side scripting like PHP or Perl, available.
Could I insert an equivalent JavaScript regex search into the HTMLarea f.onsubmit to break it down into smaller pieces prior to it being submitted back to the textarea ?
Offline
The problem I face is that there are no server side scripting like PHP or Perl, available.
Could I insert an equivalent JavaScript regex search into the HTMLarea f.onsubmit to break it down into smaller pieces prior to it being submitted back to the textarea ?
Yes,
<form ... onsubmit="this['myTextArea'].value = this['myTextArea'].value.replace(/(<\/?[a-z0-9]+>)/ig, '\1\r\n');return true">
(I'm just not sure on the backreference format in javascript regex off the top of my head, it might be $1 instead of \1)
James Sleeman
Offline