# Quotes in JavaScript string are converted to HTML entities

**URL:** <https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104>\
**Category:** Radiant CMS\
**Created:** [August 27, 2007, 5:48pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104 "2007-08-27T17:48:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [August 27, 2007, 5:48pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104/1 "2007-08-27T17:48:50Z")

</div>

Hi Radiant users,

I try to use the solution found at  
[http://lists.radiantcms.org/pipermail/radiant/2006-May/000261.html](http://lists.radiantcms.org/pipermail/radiant/2006-May/000261.html) to do  
client-side Mailer form validation using Prototype.

At the line:

The ‘mailer-form’ string is converted to ‘mailer-form’

So this script is unusable. How can I prevent this automatic conversion  
to HTML entities?

Thanks!

Jonathan

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [August 27, 2007, 5:56pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104/2 "2007-08-27T17:56:53Z")

</div>

if you are using textile you can either disable it, or wrap the  
content that shouldnt be processed in …   
blocks.

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [August 27, 2007, 7:20pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104/3 "2007-08-27T19:20:01Z")

</div>

Jonathan MÃ©tillon wrote:

> So this script is unusable. How can I prevent this automatic  
> conversion to HTML entities?  
> I found that this is the Textile filter that’s converting the quotes.

So I simply created a new snippet with no filter where I put the  
JavaScript code and I include it from my Mailer form. Now the  
client-side validation is working great!

J.

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [September 25, 2007, 11:04pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104/4 "2007-09-25T23:04:04Z")

</div>

> …
> 
> 😃
> 
> Also using a snippet, I don’t have to touch the extension hard code.
> 
> Jonathan

Let me correct : when I posted my message about snippets, I did not  
actually test it because I already had converted all my form to pure  
HTML and simply deactivated Textile filter.

But now I have another form, which is still using Textile. And I  
included my snippet, containing the JavaScript. And the JavaScript is  
again f\*\*\*d up! So I added the … tag and it  
looks better, but one character remains converted: it’s & (the  
ampersand) that is converted to &

And I really need it because I can’t use the JavaScript AND operator  
(&&)! Do you know how to stop Textile from escaping the ampersand?

Thank you.

Jonathan

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [September 25, 2007, 11:02pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104/5 "2007-09-25T23:02:02Z")

</div>

I suppose that having the Javascript in a different snippet and  
including  
it in the original snippet won’t work since the textile filter will be  
applied to all the complete snippet output. I’m right?

```
/AITOR
```

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [September 25, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104/6 "2007-09-25T23:10:22Z")

</div>

Have you tried wrapping the code in a CDATA tag? Textile might ignore  
that.

Sean

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [September 25, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104/7 "2007-09-25T23:10:53Z")

</div>

Aitor Garay-Romero wrote:

> I suppose that having the Javascript in a different snippet and including  
> it in the original snippet won’t work since the textile filter will be  
> applied to all the complete snippet output. I’m right?
> 
> ```
> /AITOR
> 
> ```

You are 🙂

Jonathan

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [September 25, 2007, 11:07pm UTC](https://www.ruby-forum.com/t/quotes-in-javascript-string-are-converted-to-html-entities/113104/8 "2007-09-25T23:07:19Z")

</div>

> > On Aug 27, 2007, at 11:47 AM, Jonathan MÃ©tillon wrote:

//\>\>/ So this script is unusable. How can I prevent this automatic  
/\>\>/ conversion //to HTML entities?//  
/\>\>/  
/\>\>/ Jonathan  
/\>

> On /Mon Aug 27 15:55:56 GMT 2007/, _Andrew B._ wrote:
> 
> if you are using textile you can either disable it, or wrap the  
> content that shouldnt be processed in …   
> blocks.

Excellent, I didn’t know about that . And is there also  
 and ?

I still prefer to use a snippet, against wrapping the code in  
…

😃

Also using a snippet, I don’t have to touch the extension hard code.

Jonathan
