Is there any fix for textarea cr/lf in ie? [solved]

ge gemlog 30 Sep, 2010
I tried both "\n" and "\r" and combinations. Also "<br>".

Again, works fine in other browsers... :-(

It just looks bad with all the text smooshed together. Have I mentioned I hate IE?
Gr GreyHead 30 Sep, 2010
Hi gemlog,

Try using nl2br in the OnSubmit Before box
<?php
$input_name = JRequest::getString('input_name', '', 'post);
$input_name = nl2br($input_name);
JRequest::setVar('input_name', $input_name);
?>


Bob
ge gemlog 30 Sep, 2010
That's a new one on me, for sure, but this is about text that is pre-set in the form as a value and then shows as smooshed only in IE.

You can see the difference here if you enter a1a1a1 as a postal code:
[deleted/fixed]
In ff it has nice breaks. In IE it is all pushed together. I've tried some things to no avail.
Gr GreyHead 30 Sep, 2010
Hi gemlog,

Sorry I misunderstood the question. Try adding <br /> tags to the preloaded text and see if that works.

Bob
ge gemlog 30 Sep, 2010
br tags make IE choke when I do the search and replace on the mp's name. I did try that. Also \n and \r etc. including 'wrap="x"'.

Here's my old line and the fix:
el_mail_body.innerHTML = s.replace('zz_mp_name_zz', full);
//fix:
el_mail_body.innerText = s.replace('zz_mp_name_zz', full);


Not a 'real' property, but it works and Firefox must use quirks mode to get around it as it looks the same in FF as well still.
ge gemlog 01 Oct, 2010
Update. My bad, I was so focused on the white space thing that I didn't notice the substitution hadn't been done in Firefox. Here's the quick fix for that:

    function isIE() {
        return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
    }

    function confirm1() {
        var full = document.getElementById('mp_fullname').innerHTML;
        $('mp_info').setStyle('display', 'none');
        $('step_one').setStyle('display', 'none');
        $('step_two').setStyle('display', 'block');
        var el_mail_body = document.getElementById('mail_body');
        var s = document.getElementById('mail_body').value;
        if (isIE()) {
            el_mail_body.innerText = s.replace('zz_mp_name_zz', full);
        } else {
            el_mail_body.innerHTML = s.replace('zz_mp_name_zz', full);
        }
    }


IE strikes again :-/
This topic is locked and no more replies can be posted.