Custom Javascript on form
Hi All, Firstly - I know my javascript/jQuery is pretty terrible - please feel free to abuse me and give me examples of what I need to do better :) I am trying to use javascript to hide the Name field on a list form if the content type is of a specific type (I will set the Name value in the PreSaveAction when save is clicked). However when my $(document).ready function runs to do the check and hide the field, it runs before the List web part has added the field control objects to the DOM. I have tried using $(window).load as well. The closest I have come to making it work the way I want is to get the SELECT ctrl for the Content Type, and then override its onchange value. However then the function ChangeContentType is undefined: jQuery(document).ready(function() { var ctSelect = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select'); alert(Start); ctSelect.bind(onchange, function() { ChangeContentType(ctSelect.attr('id')); /* THIS IS UNDEFINED */ var contentTypeRow = jQuery('table#formTbl tbody tr:nth-child(1)'); var nameRow = jQuery('nobr:contains(Name)').closest(tr) var ctSelectVal = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select option:selected'); alert(ctSelectVal.text()); // If this is Lease Matrix Document Set if (ctSelectVal.text() == Lease Matrix Document Set) {contentTypeRow.hide(); nameRow.hide(); } return false; });}); Can someone point me in the right direction? Cheers, Nigel ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
Re: Custom Javascript on form
the document ready event will fire when the DOM is ready, however if you have external script libraries which perform asynchronous changes to the DOM, then this event is rendered nearly useless. You need to ensure that your script is fired on the result of that asynchronous change. In your case, I'm tipping it's probably SP.JS. To do this, you can use SP.SOD.executeOrDelayUntilScriptLoaded with SP.js as the target. On Fri, Oct 18, 2013 at 12:12 PM, Nigel Witherdin nigel_wither...@hotmail.com wrote: Hi All, Firstly - I know my javascript/jQuery is pretty terrible - please feel free to abuse me and give me examples of what I need to do better :) I am trying to use javascript to hide the Name field on a list form if the content type is of a specific type (I will set the Name value in the PreSaveAction when save is clicked). However when my $(document).ready function runs to do the check and hide the field, it runs before the List web part has added the field control objects to the DOM. I have tried using $(window).load as well. The closest I have come to making it work the way I want is to get the SELECT ctrl for the Content Type, and then override its onchange value. However then the function ChangeContentType is undefined: jQuery(document).ready(function() { var ctSelect = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select'); alert(Start); ctSelect.bind(onchange, function() { ChangeContentType(ctSelect.attr('id')); /* THIS IS UNDEFINED */ var contentTypeRow = jQuery('table#formTbl tbody tr:nth-child(1)'); var nameRow = jQuery('nobr:contains(Name)').closest(tr) var ctSelectVal = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select option:selected'); alert(ctSelectVal.text()); // If this is Lease Matrix Document Set if (ctSelectVal.text() == Lease Matrix Document Set) { contentTypeRow.hide(); nameRow.hide(); } return false; }); }); Can someone point me in the right direction? Cheers, Nigel ___ 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
Re: Custom Javascript on form
Another alternative is to use the _spBodyOnLoadFunctionNames array. See: http://www.stephanrocks.com/2011/10/05/_spbodyonloadfunctionnames-in-sharepoint-vs-jquerys-document-ready/ Also if you are using SharePoint 2013, the JSLink functionality can accomplish the same thing as what you are trying to achieve, but is much cleaner. http://www.martinhatch.com/2013/08/jslink-and-display-templates-part-1-overview-url-tokens-and-applying-jslink-to-objects.html Mark From: Matthew Cosier cos...@gmail.commailto:cos...@gmail.com Reply-To: ozMOSS ozmoss@ozmoss.commailto:ozmoss@ozmoss.com Date: Friday, 18 October 2013 11:22 AM To: ozMOSS ozmoss@ozmoss.commailto:ozmoss@ozmoss.com Subject: Re: Custom Javascript on form the document ready event will fire when the DOM is ready, however if you have external script libraries which perform asynchronous changes to the DOM, then this event is rendered nearly useless. You need to ensure that your script is fired on the result of that asynchronous change. In your case, I'm tipping it's probably SP.JS. To do this, you can use SP.SOD.executeOrDelayUntilScriptLoaded with SP.js as the target. On Fri, Oct 18, 2013 at 12:12 PM, Nigel Witherdin nigel_wither...@hotmail.commailto:nigel_wither...@hotmail.com wrote: Hi All, Firstly - I know my javascript/jQuery is pretty terrible - please feel free to abuse me and give me examples of what I need to do better :) I am trying to use javascript to hide the Name field on a list form if the content type is of a specific type (I will set the Name value in the PreSaveAction when save is clicked). However when my $(document).ready function runs to do the check and hide the field, it runs before the List web part has added the field control objects to the DOM. I have tried using $(window).load as well. The closest I have come to making it work the way I want is to get the SELECT ctrl for the Content Type, and then override its onchange value. However then the function ChangeContentType is undefined: jQuery(document).ready(function() { var ctSelect = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select'); alert(Start); ctSelect.bind(onchange, function() { ChangeContentType(ctSelect.attr('id')); /* THIS IS UNDEFINED */ var contentTypeRow = jQuery('table#formTbl tbody tr:nth-child(1)'); var nameRow = jQuery('nobr:contains(Name)').closest(tr) var ctSelectVal = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select option:selected'); alert(ctSelectVal.text()); // If this is Lease Matrix Document Set if (ctSelectVal.text() == Lease Matrix Document Set) { contentTypeRow.hide(); nameRow.hide(); } return false; }); }); Can someone point me in the right direction? Cheers, Nigel ___ ozmoss mailing list ozmoss@ozmoss.commailto:ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
RE: Custom Javascript on form
Thanks!! Im using SP2010 and the trick of pushing it into _spBodyOnLoadFunctionNames to make it run at the end of the other scripts was just what I was after! Cheers, Nigel From: mda...@datacogs.com To: ozmoss@ozmoss.com Date: Thu, 17 Oct 2013 21:27:22 -0400 Subject: Re: Custom Javascript on form Another alternative is to use the _spBodyOnLoadFunctionNames array. See: http://www.stephanrocks.com/2011/10/05/_spbodyonloadfunctionnames-in-sharepoint-vs-jquerys-document-ready/ Also if you are using SharePoint 2013, the JSLink functionality can accomplish the same thing as what you are trying to achieve, but is much cleaner. http://www.martinhatch.com/2013/08/jslink-and-display-templates-part-1-overview-url-tokens-and-applying-jslink-to-objects.html MarkFrom: Matthew Cosier cos...@gmail.com Reply-To: ozMOSS ozmoss@ozmoss.com Date: Friday, 18 October 2013 11:22 AM To: ozMOSS ozmoss@ozmoss.com Subject: Re: Custom Javascript on form the document ready event will fire when the DOM is ready, however if you have external script libraries which perform asynchronous changes to the DOM, then this event is rendered nearly useless. You need to ensure that your script is fired on the result of that asynchronous change. In your case, I'm tipping it's probably SP.JS. To do this, you can use SP.SOD.executeOrDelayUntilScriptLoaded with SP.js as the target. On Fri, Oct 18, 2013 at 12:12 PM, Nigel Witherdin nigel_wither...@hotmail.com wrote: Hi All, Firstly - I know my javascript/jQuery is pretty terrible - please feel free to abuse me and give me examples of what I need to do better :) I am trying to use javascript to hide the Name field on a list form if the content type is of a specific type (I will set the Name value in the PreSaveAction when save is clicked). However when my $(document).ready function runs to do the check and hide the field, it runs before the List web part has added the field control objects to the DOM. I have tried using $(window).load as well. The closest I have come to making it work the way I want is to get the SELECT ctrl for the Content Type, and then override its onchange value. However then the function ChangeContentType is undefined: jQuery(document).ready(function() {var ctSelect = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select');alert(Start);ctSelect.bind(onchange, function() {ChangeContentType(ctSelect.attr('id')); /* THIS IS UNDEFINED */ var contentTypeRow = jQuery('table#formTbl tbody tr:nth-child(1)');var nameRow = jQuery('nobr:contains(Name)').closest(tr)var ctSelectVal = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select option:selected');alert(ctSelectVal.text());// If this is Lease Matrix Document Setif (ctSelectVal.text() == Lease Matrix Document Set) {contentTypeRow.hide();nameRow.hide();}return false;});}); Can someone point me in the right direction? Cheers, Nigel ___ 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 ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
Re: Custom Javascript on form
Did that resolve your problem, Nigel? 2010 a swathe of scripts that get loaded in the same manner and the final rendering of list views and forms happens very late in the piece. I had a lot of legacy jquery that broke after upgrading and the push method only resolved a few. The rest required a more brute force approach. If you're familiar with the HTML Calculated Column from the the Path To SharePoint blog, you can find a variety of solutions in his four part series for 2010. http://blog.pathtosharepoint.com/2010/06/16/html-calculated-column-solutions-for-sp-2010-part-iv/ Regards, Paul On 18 October 2013 12:45, Nigel Witherdin nigel_wither...@hotmail.comwrote: Thanks!! Im using SP2010 and the trick of pushing it into _spBodyOnLoadFunctionNames to make it run at the end of the other scripts was just what I was after! Cheers, Nigel -- From: mda...@datacogs.com To: ozmoss@ozmoss.com Date: Thu, 17 Oct 2013 21:27:22 -0400 Subject: Re: Custom Javascript on form Another alternative is to use the _spBodyOnLoadFunctionNames array. See: http://www.stephanrocks.com/2011/10/05/_spbodyonloadfunctionnames-in-sharepoint-vs-jquerys-document-ready/ Also if you are using SharePoint 2013, the JSLink functionality can accomplish the same thing as what you are trying to achieve, but is much cleaner. http://www.martinhatch.com/2013/08/jslink-and-display-templates-part-1-overview-url-tokens-and-applying-jslink-to-objects.html Mark From: Matthew Cosier cos...@gmail.com Reply-To: ozMOSS ozmoss@ozmoss.com Date: Friday, 18 October 2013 11:22 AM To: ozMOSS ozmoss@ozmoss.com Subject: Re: Custom Javascript on form the document ready event will fire when the DOM is ready, however if you have external script libraries which perform asynchronous changes to the DOM, then this event is rendered nearly useless. You need to ensure that your script is fired on the result of that asynchronous change. In your case, I'm tipping it's probably SP.JS. To do this, you can use SP.SOD.executeOrDelayUntilScriptLoaded with SP.js as the target. On Fri, Oct 18, 2013 at 12:12 PM, Nigel Witherdin nigel_wither...@hotmail.com wrote: Hi All, Firstly - I know my javascript/jQuery is pretty terrible - please feel free to abuse me and give me examples of what I need to do better :) I am trying to use javascript to hide the Name field on a list form if the content type is of a specific type (I will set the Name value in the PreSaveAction when save is clicked). However when my $(document).ready function runs to do the check and hide the field, it runs before the List web part has added the field control objects to the DOM. I have tried using $(window).load as well. The closest I have come to making it work the way I want is to get the SELECT ctrl for the Content Type, and then override its onchange value. However then the function ChangeContentType is undefined: jQuery(document).ready(function() { var ctSelect = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select'); alert(Start); ctSelect.bind(onchange, function() { ChangeContentType(ctSelect.attr('id')); /* THIS IS UNDEFINED */ var contentTypeRow = jQuery('table#formTbl tbody tr:nth-child(1)'); var nameRow = jQuery('nobr:contains(Name)').closest(tr) var ctSelectVal = jQuery('table#formTbl tbody tr:nth-child(1) td.ms-formbody select option:selected'); alert(ctSelectVal.text()); // If this is Lease Matrix Document Set if (ctSelectVal.text() == Lease Matrix Document Set) { contentTypeRow.hide(); nameRow.hide(); } return false; }); }); Can someone point me in the right direction? Cheers, Nigel ___ 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 ___ 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
Re: Urgent Help- MySite Deletion
I didnt find any link in the email body. From: Web Admin web.ad...@syd.catholic.edu.au To: ozMOSS ozmoss@ozmoss.com Sent: Thursday, 17 October 2013 3:10 PM Subject: Re: Urgent Help- MySite Deletion The generated email also provides a link to prevent deletion by confirming the site is in use. Simplest thing is for users to click it. But I understand that could be hoping for too much. ;) Regards, Paul On 17 October 2013 14:16, Ivan Wilson iv...@sharepointgurus.net wrote: Hi Zara This should help http://blogs.msdn.com/b/kaevans/archive/2012/06/25/top-recommendations-for-managing-the-my-site-cleanup-timer-job.aspx Make sure you have good backups so that you can restore if the sites do get removed. Ivan From:ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Zahra Zamanikia Sent: Thursday, 17 October 2013 1:36 PM To: ozMOSS Subject: Urgent Help- MySite Deletion Hi all, I am facing a major issue and need a quick help. User profile sync ran yesterday with a new condition in connection as a result around 700 people werent included. so they got emails that their MYsite is going to be deleted in 14 days. User profile batch jon ran as well and the bdeleted column is changed to 0. It means that all these 700 mysites are triggered for deletion. Now my question is how can I stop this deletion from database ? is there anyway to capture which flag and where is set for them to be deleted in 14 days ? Thanks, Zara ___ 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___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
Deploy a publishing site
Hi All, Could you please help me to know how can I deploy or migrate a publishing site collection from UAT server to stage or production server ? Its a brand new site collectiom which I want to add to one of the production web applications. Thanks, Zara ___ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
Re: Deploy a publishing site
There's a few options, 1) Site collection backup/restore, via the SharePoint Servers http://technet.microsoft.com/en-us/library/ee748655.aspx http://technet.microsoft.com/en-us/library/ff628582(v=office.14).aspx 2) Content Database backup/restore via the SQL Servers and attach to the production web application http://technet.microsoft.com/en-us/library/ff628582(v=office.15).aspx http://technet.microsoft.com/en-us/library/ff628582(v=office.14).aspx If the site collection storage is excessively large, say 10s of GB, I would go with option 2 as it is quicker. If the content isn't that big then option 1 is easier... You also need to remember to ensure all customisations (WSPs etc.) deployed in UAT are also deployed to production. Sezai On Fri, Oct 18, 2013 at 1:34 PM, Ivan Wilson iv...@sharepointgurus.netwrote: I would recommend doing a site collection backup/restore. You can do this from PowerShell or using STSADM command line. ** ** Ivan ** ** *From:* ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] *On Behalf Of *Zahra Zamanikia *Sent:* Friday, 18 October 2013 4:13 PM *To:* ozMOSS *Subject:* Deploy a publishing site ** ** Hi All, Could you please help me to know how can I deploy or migrate a publishing site collection from UAT server to stage or production server ? Its a brand new site collectiom which I want to add to one of the production web applications. Thanks, Zara ** ** ___ 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