Script gets commented out when added to a HTML Widget

Topics: Customizing Orchard, Troubleshooting
Apr 2, 2011 at 11:05 AM

Hello,

I'm following the instructions in the Instructions.txt file of the Contoso theme, trying to add the javascript functionality.

I go into HTML view, paste in the text from the instructions and when i press update, the entire script part gets commented out.

Any suggestions on how i could solve this? I could just edit the master page and include references to the scripts there, but i want to leave it as it is.

Apr 5, 2011 at 1:21 PM

Hello,

At least can anyone suggest the recommended way to include scripts in html content widgets?

Thank you

Developer
Apr 5, 2011 at 7:48 PM

Hey Andrei,

This is odd. It appears you're using the right view to paste in the code... I'm going to try to replicate this on my end to see if I can resolve it. Hang tight.

Michael

 

Developer
Apr 5, 2011 at 7:49 PM

Additionally, we plan to release an update to Contoso at the end of this week with some updates. If you can hang on until then I've added this as an issue to look at.

Michael

Apr 6, 2011 at 6:16 AM

Hello Michael,

Thank you for the reply. If you are unable to replicate the problem on your side, i can send you the sources or give you access to the admin panel to view the problem on my site.

Apr 6, 2011 at 7:40 AM

Problem is in TinyMce editor. Here is a workaround

1. Go to content types and open Htmlwidget in edit mode

2. Navigate to Body part and expand it

3. Change body type from 'html' to 'txt'

4. Save changes

5. Open Html widget you want to edit. Instead of TinyMce you will have plain textbox as body editor

6. Paste script into the textbox and save changes

7. Optionally, you can switch back to html editor once script is placed into the widget

Cheers,

Ivan

Ivan Pavlović | ivan.pavlovic@hive-studios.com | Hive Studios d.o.o. | www.hive-studios.com
Software Craftsman | MVP For C# MCAD MCSD MCDBA MCT Certified Scrum Master
Mike Alasa 54, 11000 Belgrade, Serbia | tel: +381 11 2928 716 | mob: + 381 63 8675 501
MSN ID: ipavlovi@hotmail.com MVP Pofile http://twitter.com/ipavlovi

From: andreiscripniciuc [email removed]
Sent: 6. april 2011 8:17
To: ipavlovi@hotmail.com
Subject: Re: Script gets commented out when added to a HTML Widget [orchard:252245]

From: andreiscripniciuc

Hello Michael,

Thank you for the reply. If you are unable to replicate the problem on your side, i can send you the sources or give you access to the admin panel to view the problem on my site.

Jun 30, 2011 at 2:00 PM

Thanks ipavlovi. This helped me to include a LinkedIn Share button which uses javascript.

http://developer.linkedin.com/community/plugins

Jan 20, 2012 at 1:21 AM
TDrouen wrote:

Thanks ipavlovi. This helped me to include a LinkedIn Share button which uses javascript.

http://developer.linkedin.com/community/plugins

I will second that!  Ah I if I had searched here earlier... I spent hours going banging my head against the wall on this one until I gave up.  The linkedin widget just would not appear (I just found this article when returning to the issue some months after).  I really should have picked up the subtle differences in the code on when displayed version.  Cheers!