Domanda

We have 2 page layouts (i.e. PageLayout A, and PageLayout B) PageLayout A require field "customername" but not require "productname" PageLayout B require field "productname" but not require "customername"

How can we accomplish this feature because if we set require fields for both fields, we have to input the value in every page layouts?

Best Regards,

È stato utile?

Soluzione 2

Thanks everyone.

It turns out that we can set the content type per page layout which mean we can specific fields for each content type.

Regards,

Andy

Altri suggerimenti

Using PreSaveAction function could be a solution. (Right before item is submitted to server, SharePoint checks for a function called PreSaveAction and if it exists, it sends item to server only if that function returns true.

You would know which layout is loaded within document.location.href string property.

var field_productname = document.querySelector('[title="productname"]').value;
var currURL = document.location.href;
if(field_productname == '' && currURL.indexOf('PageLayoutA') == -1) {
    // Set error message
    return false;
}
else
    return true;
//...
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top