Mko_
07-14-2012, 08:18 PM
Hey all,
I'm recently revising an old piece of .js code and trying to add some new features to it. However, I've encountered a bit of a roadblock and am absolutely puzzled as to how to fix it.
Let's start off with the code:
http://paste2.org/p/2073301#line-549
As you can see, I'm already modifying the variable RULES on line 549 to change all <br /> tags to be \n.
Now, the RULES var is called from an option in a setting on my Forum. In this setting, as you can probably guess, you can input a description of your rules that will display.
However, when the following contents are saved (and in turn saved in my database), this is displayed:
a
b^That is EXACTLY as it is in the database.
An image (just to be more clear):
http://i.imgur.com/GKlz8.png
Now, as you can see, there's clearly a carriage return after the 'a'.
If this bit of text is put into the setting on my Forum (mentioned earlier), my shoutbox will not work, will not load, and will not display the Shoutbox Rules tab, as depicted below:
http://i.imgur.com/OGsG1.png
Basically, what I need is either:
a) code that will ignore carriage returns or change them into <br /> tags
b) a fix for any JavaScript that may not be up-to-date and that will allow carriage returns to be interpreted as-is
Any and all help is welcomed!
Thanks,
Mark
I'm recently revising an old piece of .js code and trying to add some new features to it. However, I've encountered a bit of a roadblock and am absolutely puzzled as to how to fix it.
Let's start off with the code:
http://paste2.org/p/2073301#line-549
As you can see, I'm already modifying the variable RULES on line 549 to change all <br /> tags to be \n.
Now, the RULES var is called from an option in a setting on my Forum. In this setting, as you can probably guess, you can input a description of your rules that will display.
However, when the following contents are saved (and in turn saved in my database), this is displayed:
a
b^That is EXACTLY as it is in the database.
An image (just to be more clear):
http://i.imgur.com/GKlz8.png
Now, as you can see, there's clearly a carriage return after the 'a'.
If this bit of text is put into the setting on my Forum (mentioned earlier), my shoutbox will not work, will not load, and will not display the Shoutbox Rules tab, as depicted below:
http://i.imgur.com/OGsG1.png
Basically, what I need is either:
a) code that will ignore carriage returns or change them into <br /> tags
b) a fix for any JavaScript that may not be up-to-date and that will allow carriage returns to be interpreted as-is
Any and all help is welcomed!
Thanks,
Mark