Cross site dropdown giving wrong value on related item
I have a Crosssitelookup field(s) on a form which brings in an employee on the form.
I then have a related item field that is linked to a document library.
In the Javascript I have a bit of code (that works elsewhere)
fd.updateDroppedDocuments($('.SCForm'), function(listItem) {
//get the values from the Form fields:
var employee = fd.field("Employee_x0020_Name").value();
//set the values on uploaded document:
listItem.set_item('Employee_x0020_Name', employee);
listItem.update();
});
This should update a field Employee_x0020_Name from the form to the Employee_x0020_Name on the child library. However instead of doing this it gives a number?
What am I doing wrong?
I then have a related item field that is linked to a document library.
In the Javascript I have a bit of code (that works elsewhere)
fd.updateDroppedDocuments($('.SCForm'), function(listItem) {
//get the values from the Form fields:
var employee = fd.field("Employee_x0020_Name").value();
//set the values on uploaded document:
listItem.set_item('Employee_x0020_Name', employee);
listItem.update();
});
This should update a field Employee_x0020_Name from the form to the Employee_x0020_Name on the child library. However instead of doing this it gives a number?
What am I doing wrong?
Hi Roo,
It happens because the code 'var employee = fd.field("Employee_x0020_Name").value();' returns an ID for Cross-site lookup field.
You should use in this case:
Notice that you should replace 'Title' with the internal name of the field you want to retrieve.
You can read more about getting and setting values of the fields in the article: https://spform.com/javascript-framework ... eld-values
It happens because the code 'var employee = fd.field("Employee_x0020_Name").value();' returns an ID for Cross-site lookup field.
You should use in this case:
Code: Select all
var employee = fd.field("Employee_x0020_Name").control('data')['Title'];
You can read more about getting and setting values of the fields in the article: https://spform.com/javascript-framework ... eld-values
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests