Set value of Title field using value of Single line of text and single lookup...
Posted: 10 Oct 2017
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