Cross-site Lookup Save Problem

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Gökhan Manav
Posts: 27
Joined: Fri Nov 07, 2014

02 Feb 2015

Hi;

I used cross-site lookup on my forms.If I get value diffrent site while ı was saving my form I get below error.

When I opened form ı can see data another site on cross-site lookup.My problem seems only saving form.

What does it mean this error?



Line: 152

Error: Object doesn't support property or method 'replace'

form.min.js

var listId=container.attr('fd_list')?container.attr('fd_list'):_spPageContextInfo.pageListId;var cslInitScriptKey=('csl_init_'+containerId+'.js').replace(/-/g,'_');RegisterSod(cslInitScriptKey,(_spPageContextInfo.siteServerRelativeUrl=='/'?'':_spPageContextInfo.siteServerRelativeUrl)+'/_layouts/15/plumsail/crosssitelookup/jsinitializer.ashx?web='+encodeURIComponent(_spPageContextInfo.webServerRelativeUrl)+'&list='+listId+'&field='+encodeURIComponent(fieldName)+'&el='+encodeURIComponent(containerId)+'&key='+encodeURIComponent(cslInitScriptKey)+'&rev='+(new Date()).getTime());RegisterSodDep(cslInitScriptKey,'csl_lookup.js');LoadSodByKey(cslInitScriptKey);if(typeof(_spFormOnSubmitWrapper)!=='undefined'){var _spFormOnSubmitWrapperOrig=_spFormOnSubmitWrapper;_spFormOnSubmitWrapper=function(){var returnValue=_spFormOnSubmitWrapperOrig();if(returnValue){if(input.data('select2')&&input.data('PlumsailCrossSiteLookup')){var data=input.select2('data');var csl=input.data('PlumsailCrossSiteLookup');if(data){if(csl.multiple){var values=[];$.each(input.select2('data'),function(){values.push(this[csl.keyField]+';#'+this[csl.titleField].replace(';',';;'));});if(values.length>0){input.val(values.join(';#'));}}else{if(typeof(data[csl.keyField])!=='undefined'&&typeof(data[csl.titleField])!=='undefined'){input.val(data[csl.keyField]+';#'+data[csl.titleField].replace(';',';;'));}}}}}

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

03 Feb 2015

Hi,

Do you include any 3rd party JavaScript libraries into your master-page? Could you send HTML-source of the form page to support@spform.com?

User avatar
Gökhan Manav
Posts: 27
Joined: Fri Nov 07, 2014

03 Feb 2015

All of my javascript code below.If I change cross-site lookup list field number to string error fix.But why this error rising cross-site lookup list field string.

var ID = fd.getUrlParam(window.location.href, 'ID');

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', loadSPjs);



fd.field('Bildiren').readonly(true);

fd.field('BildirenBolum').readonly(true);

fd.field('BildirenTakimLideri').readonly(true);

fd.field('Amir').readonly(true);





if(!ID)

{

$('.RelatedTable').hide();

}



fd.onsubmit(function() {

if(!ID)

{

var uri = fd.setUrlParam(decodeURIComponent(window.location.href), 'FDRedirectWithID', 'fd_Item_Edit.aspx?ID=');

fd.sourceFormParam(uri);

}else

{

fd.backToPrevForm();

}



fd.field('Bildiren').readonly(false);

fd.field('BildirenBolum').readonly(false);

fd.field('BildirenTakimLideri').readonly(false);

fd.field('Amir').readonly(false);



return true;

});



function loadSPjs()

{

var personelId=fd.field('Personel').value();

}





function onRequestSucceeded() {



var personelId=fd.field('Personel').value();

var ctx =new SP.ClientContext('http://portal.cimtas.com/group/yalin');

var oList = ctx.get_web().get_lists().getByTitle('Çalışan Listesi');



var camlQuery = new SP.CamlQuery();

camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +

'<Value Type=\'Number\'>'+personelId+'</Value></Geq></Where></Query><RowLimit>1</RowLimit></View>');

this.collListItem = oList.getItems(camlQuery);



ctx.load(collListItem);



ctx.executeQueryAsync(function()

{

var listItemInfo = '';



var listItemEnumerator = collListItem.getEnumerator();

while (listItemEnumerator.moveNext())

{

var oListItem = listItemEnumerator.get_current();

var bildiren= oListItem.get_item('Title');

var departman= oListItem.get_item('departman');

var amir = oListItem.get_item('amir')

fd.field('Bildiren').value(bildiren);

fd.field('BildirenBolum').value(departman);

fd.field('Amir').value(amir);

fd.field('BildirenTakimLideri').readonly(false);

}

});

}



fd.field('Personel').change(function () {



onRequestSucceeded() ;

});





function IsCurrentUserMemberOfGroup(groupName, OnComplete) {



var currentContext = new SP.ClientContext.get_current();

var currentWeb = currentContext.get_web();



var currentUser = currentContext.get_web().get_currentUser();

currentContext.load(currentUser);



var allGroups = currentWeb.get_siteGroups();

currentContext.load(allGroups);



var group = allGroups.getByName(groupName);

currentContext.load(group);



var groupUsers = group.get_users();

currentContext.load(groupUsers);



currentContext.executeQueryAsync(OnSuccess,OnFailure);



function OnSuccess(sender, args) {

var userInGroup = false;

var groupUserEnumerator = groupUsers.getEnumerator();

while (groupUserEnumerator.moveNext()) {

var groupUser = groupUserEnumerator.get_current();

if (groupUser.get_id() == currentUser.get_id()) {

userInGroup = true;

break;

}

}

OnComplete(userInGroup);

}



function OnFailure(sender, args) {

OnComplete(false);

}

}



function IsCurrentUserHasContribPerms()

{

IsCurrentUserMemberOfGroup("HSE Contribute", function (isCurrentUserInGroup) {

if(!isCurrentUserInGroup)

{

fd.field('KazaTipi').readonly(true);

fd.field('OlayTipi').readonly(true);

fd.field('OlayOnlenebilirlik').readonly(true);

fd.field('AnaBaslik').readonly(true);

fd.field('AltBaslik').readonly(true);

}

});



}

ExecuteOrDelayUntilScriptLoaded(IsCurrentUserHasContribPerms, 'SP.js');

Thanks..

User avatar
Gökhan Manav
Posts: 27
Joined: Fri Nov 07, 2014

03 Feb 2015

All of my javascript code below.If I change cross-site lookup list field number to string error fix.But why this error rising cross-site lookup list field string.

var ID = fd.getUrlParam(window.location.href, 'ID');

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', loadSPjs);



fd.field('Bildiren').readonly(true);

fd.field('BildirenBolum').readonly(true);

fd.field('BildirenTakimLideri').readonly(true);

fd.field('Amir').readonly(true);





if(!ID)

{

$('.RelatedTable').hide();

}



fd.onsubmit(function() {

if(!ID)

{

var uri = fd.setUrlParam(decodeURIComponent(window.location.href), 'FDRedirectWithID', 'fd_Item_Edit.aspx?ID=');

fd.sourceFormParam(uri);

}else

{

fd.backToPrevForm();

}



fd.field('Bildiren').readonly(false);

fd.field('BildirenBolum').readonly(false);

fd.field('BildirenTakimLideri').readonly(false);

fd.field('Amir').readonly(false);



return true;

});



function loadSPjs()

{

var personelId=fd.field('Personel').value();

}





function onRequestSucceeded() {



var personelId=fd.field('Personel').value();

var ctx =new SP.ClientContext('http://portal.cimtas.com/group/yalin');

var oList = ctx.get_web().get_lists().getByTitle('Çalışan Listesi');



var camlQuery = new SP.CamlQuery();

camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +

'<Value Type=\'Number\'>'+personelId+'</Value></Geq></Where></Query><RowLimit>1</RowLimit></View>');

this.collListItem = oList.getItems(camlQuery);



ctx.load(collListItem);



ctx.executeQueryAsync(function()

{

var listItemInfo = '';



var listItemEnumerator = collListItem.getEnumerator();

while (listItemEnumerator.moveNext())

{

var oListItem = listItemEnumerator.get_current();

var bildiren= oListItem.get_item('Title');

var departman= oListItem.get_item('departman');

var amir = oListItem.get_item('amir')

fd.field('Bildiren').value(bildiren);

fd.field('BildirenBolum').value(departman);

fd.field('Amir').value(amir);

fd.field('BildirenTakimLideri').readonly(false);

}

});

}



fd.field('Personel').change(function () {



onRequestSucceeded() ;

});





function IsCurrentUserMemberOfGroup(groupName, OnComplete) {



var currentContext = new SP.ClientContext.get_current();

var currentWeb = currentContext.get_web();



var currentUser = currentContext.get_web().get_currentUser();

currentContext.load(currentUser);



var allGroups = currentWeb.get_siteGroups();

currentContext.load(allGroups);



var group = allGroups.getByName(groupName);

currentContext.load(group);



var groupUsers = group.get_users();

currentContext.load(groupUsers);



currentContext.executeQueryAsync(OnSuccess,OnFailure);



function OnSuccess(sender, args) {

var userInGroup = false;

var groupUserEnumerator = groupUsers.getEnumerator();

while (groupUserEnumerator.moveNext()) {

var groupUser = groupUserEnumerator.get_current();

if (groupUser.get_id() == currentUser.get_id()) {

userInGroup = true;

break;

}

}

OnComplete(userInGroup);

}



function OnFailure(sender, args) {

OnComplete(false);

}

}



function IsCurrentUserHasContribPerms()

{

IsCurrentUserMemberOfGroup("HSE Contribute", function (isCurrentUserInGroup) {

if(!isCurrentUserInGroup)

{

fd.field('KazaTipi').readonly(true);

fd.field('OlayTipi').readonly(true);

fd.field('OlayOnlenebilirlik').readonly(true);

fd.field('AnaBaslik').readonly(true);

fd.field('AltBaslik').readonly(true);

}

});



}

ExecuteOrDelayUntilScriptLoaded(IsCurrentUserHasContribPerms, 'SP.js');

Thanks..

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

04 Feb 2015

Please, download and install the latest versions of Forms Designer and Cross-site Lookup:

http://spform.com/download

Next, re-activate Forms Designer and Cross-site Lookup features at the site collection level.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests