Set value of Title field using value of Single line of text and single lookup...
Hi,
I'm trying to set the value of the 'Title' field by getting the value of Manufacturer, which is a single choice lookup and the value of Model Number, which is a single line of text.
The code is as follows;
/*INITIAL SETUP*/
// Hides required fields and items
$('.prodservicecode').show();
/*INITIAL SETUP ABOVE - CALLS AND FUNCTIONS BELOW*/
// Calling Functions on form loading
setProductServiceCode();
// Calling Functions when the user changes the values
//fd.field('Model_x0020_Number').change(setProductServiceCode);
fd.field('Model_x0020_Number').change(setProductServiceCode(){});
//fd.field('Manufacturer').change(setProductServiceCode);
fd.field('Manufacturer').change(setProductServiceCode(){});
/*CALLS AND INITIAL SETUP ABOVE - ALL FUNCTIONS BELOW*/
// Function to set Product/Service Code
function setProductServiceCode () {
var modelnumber = fd.field('Model_x0020_Number')value();
//when this is enabled we get the ID of Manufacturer returned
var manufacturer = fd.field('Manufacturer').value();
//var manufacturer = fd.field('Manufacturer').control('getSelectedText');
fd.field("Title").value(manufacturer + '-' + modelnumber);
}
I have had the value of the ID of the Manufacturer returned but when I change the script to get the text value of the lookup I either get a blank Title field or I get [Value - Value] - Model Number.
Can you pinpoint where my code is wrong please? I'm sure it is a simple fix..
Thanks
Paul
I'm trying to set the value of the 'Title' field by getting the value of Manufacturer, which is a single choice lookup and the value of Model Number, which is a single line of text.
The code is as follows;
/*INITIAL SETUP*/
// Hides required fields and items
$('.prodservicecode').show();
/*INITIAL SETUP ABOVE - CALLS AND FUNCTIONS BELOW*/
// Calling Functions on form loading
setProductServiceCode();
// Calling Functions when the user changes the values
//fd.field('Model_x0020_Number').change(setProductServiceCode);
fd.field('Model_x0020_Number').change(setProductServiceCode(){});
//fd.field('Manufacturer').change(setProductServiceCode);
fd.field('Manufacturer').change(setProductServiceCode(){});
/*CALLS AND INITIAL SETUP ABOVE - ALL FUNCTIONS BELOW*/
// Function to set Product/Service Code
function setProductServiceCode () {
var modelnumber = fd.field('Model_x0020_Number')value();
//when this is enabled we get the ID of Manufacturer returned
var manufacturer = fd.field('Manufacturer').value();
//var manufacturer = fd.field('Manufacturer').control('getSelectedText');
fd.field("Title").value(manufacturer + '-' + modelnumber);
}
I have had the value of the ID of the Manufacturer returned but when I change the script to get the text value of the lookup I either get a blank Title field or I get [Value - Value] - Model Number.
Can you pinpoint where my code is wrong please? I'm sure it is a simple fix..
Thanks
Paul
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello, Paul!
Regarding this Manufacturer single choice Lookup - is it default Microsoft Lookup or Cross-site Lookup? In case it is Cross-site Lookup, you need to use the following code instead:
Regarding this Manufacturer single choice Lookup - is it default Microsoft Lookup or Cross-site Lookup? In case it is Cross-site Lookup, you need to use the following code instead:
Code: Select all
var manufacturer = fd.field('Manufacturer').control('data')['Title'];
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests