#StackBounty: #2013 #development #sharepoint-on-prem #publishing-site #enterprise-wiki Unable to add a validation for our enterprise wi…

Bounty: 50

I am working on an enterprise wiki site collection inside sharepoint 2013 farm. i have a custom date field named “ExpireDate”, and i added a validation inside the Pages library’s Validation settings, to force the “ExpireDate” to be in the future as follow:-

enter image description here

but when i tried to create a new wiki page i got this error, so now i am unable to create new wiki pages unless i remove the validation:-
enter image description here

so can anyone advice on what is the correct way to add field validations for our enterprise wiki pages? should i add the validation inside the page layout instead of using the Validation setting inside the pages library ?


Get this bounty!!!

#StackBounty: #2013 #page-layout #list-view-web-part How to add Pages Library to page layout

Bounty: 100

We are using the page publishing features and I’m trying to put together a custom page layout that includes a list view of the pages library.

I’ve gone into the Snippets gallery but there isn’t a choice to create a list view snippet.

I found this thread. But don’t understand the answers. Some of the answers there seem to be for SP Online and we are using SP 2013. The second one says to put this code in a webpart zone

<WebPartPages:XsltListViewWebPart ID="XsltListViewWebPart2" 
    runat="server" ListUrl="Lists/PublicDocuments" IsIncluded="True" 
    NoDefaultStyle="TRUE" Title="Public Documents" PageType="PAGE_NORMALVIEW" FrameType="None"
    Default="False" ViewContentTypeId="0x"> 
</WebPartPages:XsltListViewWebPart>

I used the custom ASP.NET markup feature in the snippets gallery and change the url to point to the pages library.

<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<WebPartPages:XsltListViewWebPart ID="XsltListViewWebPart2" 
    runat="server" ListUrl="Pages" IsIncluded="True" 
    NoDefaultStyle="TRUE" Title="Pages" PageType="PAGE_NORMALVIEW" FrameType="None"
    Default="False" ViewContentTypeId="0x"> -->
<!--SPM:</WebPartPages:XsltListViewWebPart>-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->

In the design manager preview for the page layout this works, except it shows the page library for the site collection level and not the subsite. When I try and create a page with this webpart on it I get an error. If I change the url to try and direct to the subsite it doesn’t even work in the preview.

List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user.

Additionally I need to configure a lot of the properties for the list view and don’t know what they are called, so a version of this with the properties would be helpful

It seems to me that a page with a list view is kind of an important thing that should be easy and pretty much needed all the time, yet I can’t find anything on line that actually shows how to do it.

How can I create the right kind of markup to add to our pagelayout html to show the pages library?


Get this bounty!!!

#StackBounty: #2013 #taxonomy #managed-navigation How to reuse navigation terms multiple times

Bounty: 100

We have a site with two different sections — one for each of the groups in our team. We are using managed navigation and friendly urls. The two different groups have agreed on a phase taxonomy for presenting our content that will be familar across the site. Resources, pages, documents, etc. will be tagged with terms for which group it belows to and for what phase it is a part of, and from that metadata a content search web parts will be used to get the term from the url and show the correct documents. So like this.

The phase termset contains:

  • Define
  • Design
  • Implement
  • Sustain

And the groups termset contains:

  • Group 1
  • Group 2

I want to reuse the terms so I can have a navigation like:

  • Group 1
    • Define
    • Design
    • Implement
    • Sustain
  • Group 2
    • Define
    • Design
    • Implement
    • Sustain

And that will generate friendly urls like

  • site/group1/design
  • site/group2/design

When I try to repin or reuse the phase terms under the group terms I get an error message Terms can not be shared multiple times in the same term set.

How can I reuse the terms in multiple places?


Get this bounty!!!

#StackBounty: #2013 #javascript #edit-form #sp.ui.modaldialog.showmodaldialog Prevent item form delete from redirecting

Bounty: 100

TL;DR

I need a way to prevent the edit form dialog (iframe) from navigating the top window when I click delete on an edit form.

I found this thread the answer given (also detailed in this blog post) relies on adding some code to the masterpage that runs all the time.

I’m looking for a client-side javascript version that doesn’t change the behavior for every list, but is able to be applied just to either a specific edit form (via csr or a content/script web part) or added the page that launches the edit form.

Below is more information and a few things I’ve tried.

Details

I have a list that I’m retrieving items from and displaying using REST api. From my custom interface I’m adding a link that will open the list edit form in a modal window using code like this:

SP.UI.ModalDialog.showModalDialog({
            title: 'Edit item', 
            url: <site url>/_layouts/15/listform.aspx?PageType=6&ID=<itemId>&ListId={<list guid>},
            height:550,
            dialogReturnValueCallback: function(dialogResult){
                if(dialogResult === SP.UI.DialogResult.OK){
                    // Make a rest call to get the updated values and show them
... and so on

This is working great for updates or if the user clicks cancel, that is to say the modal dialog closes and the calls the callback function where I can check if they clicked save or cancel.

However if the user clicks delete (which they need to do from time to time) the modal dialog closes with no callback and redirects the original (top) page to the default AllItems view for the list. I notice that even in a regular list the same thing happens — deleting an item doesn’t return you to where you were, but rather the default view.

I want to prevent this from happening. I found this post which requires adding the following code to every page via the master page.

var ref = document.referrer;  // Stores URL of previous page.
var url = window.location.pathname; // Stores URL of current page.

// The following code will run if the user edits a list item or properties of 
// a document.
if (url.indexOf("EditForm.aspx") > -1) {
 sessionStorage.setItem("page", ref);
}

if (url.indexOf("AllItems.aspx") > -1 
    && ref.indexOf("EditForm.aspx") > -1) {
 window.location = sessionStorage.getItem("page");
}

I’d prefer not to have to have to create a custom masterpage. I’d also prefer to not have to have the solution on every page, I’m trying to find a solution that I can perhaps put into a jslink/client-side rendering and have it only on the forms that I want to behave differently than the default. There are many other users of our site who might not want it to change.

I’m specifically annoyed with this behavior when using the modal dialogs — whether directly from a list that has `List settings>Advanced settings>Launch forms in a dialog?>Yes’ or ShowModal as above. Because the modeal/dialog is presented in an iframe that got me thinking about iframe sandboxing and found this thread. I don’t know how to change the sandbox properties on the iframe so the accepted solution probably isn’t the best.

I also found this solution which uses a custom onbeforeunload handler to prevent the iframe from navigating the parent. However I don’t know what to put for this line which is what prevents the navigation:

console.log("About to navigate that we should stop!");
window.top.location = 'http://server-which-responds-with-204.com/';

If I leave that line out I can see in my debugger that the code around that runs, but the top frame still navigates. If I put something like

window.top.location = window.top.location

I at least stay on the same page, but it reloads. I would like to find a way to not reload the page if I can.

Does anyone know what I should replace the location value with?

Does anybody have a different solution that would work better and only need to be on either the calling page or the specific form that I want to behave this way?


Get this bounty!!!