Hehe. I figured. I was just joking. My function call has multiple params and also contains an if/else block.
If I strip the code right back I can successfully alert the current user info, so I know the context IS being 'got'. I'm sure it'll wind up being a syntactic oversight but this doesn't explain why it would work in Edit mode. :\ On 28 November 2012 10:42, Ishai Sagi <is...@exd.com.au> wrote: > Sorry – that should have had instructions to replace ViewItem with the > name of your function.**** > > How about trying to put your function in **** > > spBodyOnLoadFunctionNames.push( )**** > > ** ** > > ** ** > > **[image: Description: Description: C:\Users\Brian\Pictures\EXD > Logos\Extelligent logo no text.jpg]***Ishai Sagi* | Solutions Architect > 0488 789 786 | is...@exd.com.au | www.sharepoint-tips.com | > @ishaisagi<http://twitter.com/ishaisagi> > | MVP Profile <https://mvp.support.microsoft.com/profile/Ishai> **** > > ** ** > > *From:* ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] *On > Behalf Of *Web Admin > *Sent:* Wednesday, 28 November 2012 10:30 AM > > *To:* ozMOSS > *Subject:* Re: JS Client OM - script only runs in edit mode**** > > ** ** > > Hi Ishai,**** > > ** ** > > I get 'ViewItem' is undefined. And it has the added benefit of breaking > editing of the CEWP. :)**** > > ** ** > > I'd originally tried passing my function in the same way but it made no > difference.**** > > ** ** > > The script obviously works, just not in browser mode.**** > > ** ** > > On 28 November 2012 10:09, Ishai Sagi <is...@exd.com.au> wrote:**** > > Can you add the following to the page just to test?**** > > **** > > *<script* type="text/javascript"*>***** > > window.onload = function(){ ExecuteOrDelayUntilScriptLoaded(ViewItem, > "sp.js"); };**** > > *</script>***** > > **** > > **** > > **** > > **[image: Description: Description: C:\Users\Brian\Pictures\EXD > Logos\Extelligent logo no text.jpg]***Ishai Sagi* | Solutions Architect > 0488 789 786 | is...@exd.com.au | www.sharepoint-tips.com | > @ishaisagi<http://twitter.com/ishaisagi> > | MVP Profile <https://mvp.support.microsoft.com/profile/Ishai> **** > > **** > > *From:* ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] *On > Behalf Of *Web Admin > *Sent:* Wednesday, 28 November 2012 10:00 AM > *To:* ozMOSS > *Subject:* Re: JS Client OM - script only runs in edit mode**** > > **** > > Hi Iain,**** > > **** > > I can see why it's failing. It's not getting the context. I just don't why > it's failing in view mode. I assumed the js client resources would be > available by default?**** > > **** > > SCRIPT5007: Unable to get value of the property 'get_current': object is > null or undefined [ln 796]**** > > **** > > 795 //Get an instance of the Client Content.**** > > 796 currentContext = new SP.ClientContext.get_current();**** > > **** > > **** > > **** > > On 27 November 2012 15:33, Iain Carlin <cut...@gmail.com> wrote:**** > > Hi Paul, > > Don't have a direct answer for you, but if you use IE Developer Tools > (F12) you will see what scripts aren't being loaded. > > (I had a similar experience the other day and it was due to an included js > file being checked out - F12 helped me find which one). > > Cheers, Iain**** > > On 27 November 2012 13:57, Web Admin <web.ad...@syd.catholic.edu.au> > wrote:**** > > 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**** > > **** > > _______________________________________________ > ozmoss mailing list > ozmoss@ozmoss.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss**** > > > > _______________________________________________ > ozmoss mailing list > ozmoss@ozmoss.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss**** > > > > **** > > **** > > -- **** > > Regards,**** > > **** > > Paul Noone**** > > **** > > SharePoint Farm Admin/Developer > Infrastructure Team > CEO Sydney > > p: (02) 9568 8461 > f: (02) 9568 8483 > e: paul.no...@syd.catholic.edu.au > w: http://www.ceosyd.catholic.edu.au/**** > > **** > > > _______________________________________________ > ozmoss mailing list > ozmoss@ozmoss.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss**** > > > > **** > > ** ** > > -- **** > > Regards,**** > > ** ** > > Paul Noone**** > > ** ** > > SharePoint Farm Admin/Developer > Infrastructure Team > CEO Sydney > > p: (02) 9568 8461 > f: (02) 9568 8483 > e: paul.no...@syd.catholic.edu.au > w: http://www.ceosyd.catholic.edu.au/**** > > ** ** > > _______________________________________________ > ozmoss mailing list > ozmoss@ozmoss.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss > > -- Regards, Paul Noone SharePoint Farm Admin/Developer Infrastructure Team CEO Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: paul.no...@syd.catholic.edu.au w: http://www.ceosyd.catholic.edu.au/
<<image004.jpg>>
<<image003.jpg>>
_______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss