Hiya,
I fixed the problem with regex.
As for this: fd.field('FieldName').value.LookupValue
The code runs fine but errors are sill present in the console.
Here is the code that is powering that section:
fd.spRendered(function() {
fd.field('RERostering').disabled = true
fd.field('Question_1').$on('change', function() {
fd.field('RERostering').value = fd.field('Question_1').value;
})
fd.field('RLeavingTrust').disabled = true
fd.field('Question_2').$on('change', function() {
fd.field('RLeavingTrust').value = fd.field('Question_2').value;
})
fd.field('RTermAssignment').disabled = true
fd.field('Question_3').$on('change', function() {
fd.field('RTermAssignment').value = fd.field('Question_3').value;
})
fd.field('RSupervisorEmail').disabled = true
fd.field('Supervisor_Email_Address').$on('change', function() {
fd.field('RSupervisorEmail').value = fd.field('Supervisor_Email_Address').value;
})
fd.field('RSupervisorFirstName').disabled = true
fd.field('Supervisor_First_Name').$on('change', function() {
fd.field('RSupervisorFirstName').value = fd.field('Supervisor_First_Name').value;
})
fd.field('RSupervisorLastName').disabled = true
fd.field('Supervisor_Last_Name').$on('change', function() {
fd.field('RSupervisorLastName').value = fd.field('Supervisor_Last_Name').value;
})
fd.field('RTitle').disabled = true
fd.field('Titles').$on('change', function() {
fd.field('RTitle').value = fd.field('Titles').value;
})
fd.field('RFirstName').disabled = true
fd.field('First_Name').$on('change', function() {
fd.field('RFirstName').value = fd.field('First_Name').value;
})
fd.field('RLastName').disabled = true
fd.field('Last_Name').$on('change', function() {
fd.field('RLastName').value = fd.field('Last_Name').value;
})
fd.field('RAssignNum').disabled = true
fd.field('Assignment_Number').$on('change', function() {
fd.field('RAssignNum').value = fd.field('Assignment_Number').value;
})
fd.field('REmailAddress').disabled = true
fd.field('Email_Address').$on('change', function() {
fd.field('REmailAddress').value = fd.field('Email_Address').value;
})
fd.field('RPayBand').disabled = true
fd.field('Pay_Band').$on('change', function() {
fd.field('RPayBand').value = fd.field('Pay_Band').value;
})
fd.field('RCostCentreCode').disabled = true
fd.field('Cost_Centre').$on('change', function() {
fd.field('RCostCentreCode').value = fd.field('Cost_Centre').value;
})
fd.field('RDepartment').disabled = true
fd.field('Department').$on('change', function() {
fd.field('RDepartment').value = fd.field('Department').value.LookupValue;
})
//This code will retrieve the auto-populated values from Wizard 2
fd.field('RSpeciality').disabled = true
fd.field('Speciality').$on('change', function(value){
//check that field has no additional data
if(typeof value == 'number'){
fd.field('Speciality').reloadValue().then(function(){
fd.field('RSpeciality').value = fd.field('Speciality').value.LookupValue;
})
}
else if(value != null) {
fd.field('RSpeciality').value = value.LookupValue
}
})
//Directorate
fd.field('RDirectorate').disabled = true
fd.field('Directorate').$on('change', function(value){
//check that field has no additional data
if(typeof value == 'number'){
fd.field('Directorate').reloadValue().then(function(){
fd.field('RDirectorate').value = fd.field('Directorate').value.LookupValue;
})
}
else if(value != null) {
fd.field('RDirectorate').value = value.LookupValue
}
})
//Division
fd.field('RDivision').disabled = true
fd.field('Division').$on('change', function(value){
//check that field has no additional data
if(typeof value == 'number'){
fd.field('Division').reloadValue().then(function(){
fd.field('RDivision').value = fd.field('Division').value.LookupValue;
})
}
else if(value != null) {
fd.field('RDivision').value = value.LookupValue
}
})
//Hospital
fd.field('RHospital').disabled = true
fd.field('Hospital').$on('change', function(value){
//check that field has no additional data
if(typeof value == 'number'){
fd.field('Hospital').reloadValue().then(function(){
fd.field('RHospital').value = fd.field('Hospital').value.LookupValue;
})
}
else if(value != null) {
fd.field('RHospital').value = value.LookupValue
}
})
fd.field('RStaffGroup').disabled = true
fd.field('Main_Staff_Group').$on('change', function() {
fd.field('RStaffGroup').value = fd.field('Main_Staff_Group').value;
})
fd.field('RTerminationDate').disabled = true
fd.field('Employee_Termination_Date').$on('change', function() {
fd.field('RTerminationDate').value = fd.field('Employee_Termination_Date').value.toDateString();
})
fd.field('RLastWorkingDay').disabled = true
fd.field('Employee_Last_Working_Day').$on('change', function() {
fd.field('RLastWorkingDay').value = fd.field('Employee_Last_Working_Day').value.toDateString();
})
fd.field('RReasonForDifference').disabled = true
fd.field('Reason_For_Difference').$on('change', function() {
fd.field('RReasonForDifference').value = fd.field('Reason_For_Difference').value;
})
fd.field('RLeavingReason').disabled = true
fd.field('Leaving_Reason').$on('change', function() {
fd.field('RLeavingReason').value = fd.field('Leaving_Reason').value.LookupValue;
})
//ResignationType
fd.field('RResignationType').disabled = true
fd.field('Resignation_Type').$on('change', function(value){
//check that field has no additional data
if(typeof value == 'number'){
fd.field('Resignation_Type').reloadValue().then(function(){
fd.field('RResignationType').value = fd.field('Resignation_Type').value.LookupValue;
})
}
else if(value != null) {
fd.field('RResignationType').value = value.LookupValue
}
})
fd.field('RDestinationOnLeaving').disabled = true
fd.field('Destination_On_Leaving').$on('change', function() {
fd.field('RDestinationOnLeaving').value = fd.field('Destination_On_Leaving').value;
})
fd.field('RNHSOrganisationLeavingTo').disabled = true
fd.field('NHS_Organisation_Leaving_To').$on('change', function() {
fd.field('RNHSOrganisationLeavingTo').value = fd.field('NHS_Organisation_Leaving_To').value.LookupValue;
})
fd.field('RNHSOrganisationLeavingTo').disabled = true
fd.field('NHS_Organisation_Leaving_To').$on('change', function() {
fd.field('RNHSOrganisationLeavingTo').value = fd.field('NHS_Organisation_Leaving_To').value.LookupValue;
})
//ResignationType
fd.field('RVPD').disabled = true
fd.field('VPD').$on('change', function(value){
//check that field has no additional data
if(typeof value == 'number'){
fd.field('VPD').reloadValue().then(function(){
fd.field('RVPD').value = fd.field('VPD').value.LookupValue;
})
}
else if(value != null) {
fd.field('RVPD').value = value.LookupValue
}
})
fd.field('RHolidayHoursDue').disabled = true
fd.field('Holidays_Hours_Due').$on('change', function() {
fd.field('RHolidayHoursDue').value = fd.field('Holidays_Hours_Due').value;
})
fd.field('RHolidayHoursOverpaid').disabled = true
fd.field('Holiday_Hours_Overpaid').$on('change', function() {
fd.field('RHolidayHoursOverpaid').value = fd.field('Holiday_Hours_Overpaid').value;
})
fd.field('RLieuHoursOutstanding').disabled = true
fd.field('Lieu_Hours_Outstanding').$on('change', function() {
fd.field('RLieuHoursOutstanding').value = fd.field('Lieu_Hours_Outstanding').value;
})
fd.field('RPaymentsLieuNotice').disabled = true
fd.field('Payments_Made_In_Lieu_Notice').$on('change', function() {
fd.field('RPaymentsLieuNotice').value = fd.field('Payments_Made_In_Lieu_Notice').value;
})
fd.field('RDateLeavingPost').disabled = true
fd.field('Date_Employee_Leaving_Post').$on('change', function() {
fd.field('RDateLeavingPost').value = fd.field('Date_Employee_Leaving_Post').value.toDateString();
})
});