I've actually just been doing something like this. As soon as you check in the 
page, all javascript etc in a CEWP is removed. The way I worked around it is to 
put everything in a text file, save the text file to a document library, and 
reference that from the CEWP.

My text file is attached (if it makes it to the list) and then when you add the 
CEWP, the very first option gives you a chance to pull in content from a url - 
simply insert the url to the text file.

From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Web Admin
Sent: Tuesday, 27 November 2012 2:27 PM
To: ozMOSS
Subject: JS Client OM - script only runs in edit mode

Hi all,

I have added some JavaScript to a CEWP on a list view. It runs beautifully when 
the page is in edit mode but does nothing when not.

I'm assuming that a required js file is not being loaded in view mode but am 
stumped.

I have a script reference to my jQuery lib. This is correct and proven.

Am I missing something? A reference to sp.js or something else blindingly 
obvious?

Regards,

Paul

________________________________

Stockland Notice: If this communication has been sent to you by mistake, please 
delete and notify us. If it has been sent to you by mistake, legal privilege is 
not waived or lost and you are not entitled to use it in any way. Stockland and 
its subsidiaries reserve the right to monitor e-mail communication through its 
networks.
ÿþ<script type="text/javascript"> 

var options = { 

url: 
"/circles/ITcircle/Lists/Innovation/NewForm.aspx",
 

        title: "Respond to survey", 

        allowMaximize: true, 

        showClose: true, 

        width: 925, 

        height: 725, 

        dialogReturnValueCallback: 
silentCallback}; 

function open() 
{SP.UI.ModalDialog.showModalDialog(options);}
 

function silentCallback(dialogResult, 
returnValue) { 

} 

function refreshCallback(dialogResult, 
returnValue) { 

    
SP.UI.Notify.addNotification('Operation 
Successful!'); 

    
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
 

} 

</script>





<table width="100%" 
class="ms-rteTable-SGP" 
cellspacing="0"><tbody><tr 
class="ms-rteTableHeaderRow-SGP"><th 
class="ms-rteTableHeaderEvenCol-SGP">Calling
 all Innovators! </th>

<th 
class="ms-rteTableHeaderOddCol-SGP"> 
</th></tr>

<tr class="ms-rteTableOddRow-SGP"><td 
class="ms-rteTableEvenCol-SGP">Now is 
the time to bring your great idea to 
life!<br/><br/>

Innovation is an important part of our 
business, but time constraints mean our 
ideas sometimes don't get off the 
ground. We want to change 
that.<br/><br/>

In December and January we want you to 
have the opportunity to build and 
showcase your innovation that can 
benefit us in IT, our business 
colleagues or Stockland's 
customers.<br/><br/>

We'll have more information soon, but 
to start we want you to tell us about 
your idea by answering a few simple 
questions.

<p><br/>

<a href="javascript:open()">Click 
here</a> to launch the survey.</p></td>

<td class="ms-rteTableOddCol-SGP"><div 
style="text-align: right"><img 
width="326" height="349" 
alt="Innovation.jpg" 
src="/circles/ITcircle/PublishingImages/Innovation.jpg"
 style="margin: 5px; height: 
289px"/></div></td></tr></tbody></table>
_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to