ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Live Comment Preview Stopped Working?

July 09, 2007 7:12pm

Subscribe [1]
  • #1 / Jul 09, 2007 7:12pm

    Vik

    209 posts

    I’ve had Live Comment Preview working my site for a long time, via ReloadTextDiv, as described in the Wiki.

    I just moved to a new web host, and for some reason, Live Comment Preview stopped working. Text typed does not appear in the Live Preview textarea.

    Does anyone have any thoughts on what could cause this? Thanks in advance for any info.

  • #2 / Jul 09, 2007 8:14pm

    Vik

    209 posts

    I got it working.

  • #3 / Jul 10, 2007 2:05pm

    Vik

    209 posts

    Since this was very mysterious to me at first, I thought I would post the answer I found, for future reference.

    The question was, why would some JavaScript that worked perfectly well on my previous web host, stop working on a new web host?

    Here’s the JavaScript, a revised version of ReloadTextDiv from the EE wiki. (Note: I found that the ReloadTextDiv from the EE wiki ran fine on both hosts.)

    
    
    

    I downloaded the Firefox extension called FireBug, that contains a great JavaScript debugger. It showed me that these lines were considered incomplete:

    splitText = NewText.split(/
    
    /).join("
    ");
            splitText = splitText.split(/
    /).join("
    ");

    I tried replacing the new line characters with control characters (in Javascript, “\n”  means the same invisible “new line” character that you get when you hit the return key on your keyboard). That fixed it. Here’s the version that’s now working on my site:

    
    
    

    I guess some web hosts require the “\n” character.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases