Populating a dropdown field value from parent
Posted: 23 Dec 2019
in a "new" Form, I have created a function where when one dropdown item is selected (a driver), all that driver's information populates on the "new" form fields.
However, 2 of those fields are drops downs:'
- one is a list selection (single)
- the other is a lookup fields
Neither of these fields populate. I checked the java syntax area and it seems as though it should work -however the values never change.
What am I doing wrong?
Fields: AppState (select) / Driver_x0020_State (lookup)
Help is deeply appreciated. It feels like I'm missing something small (not very experienced with java)
Code:
fd.field('Driver_x0020_Lookup').change(function(){
if(fd.field('Driver_x0020_Lookup').value().length > 0){
//retrieve your extra fields and populate fields on the form
fd.field('First_x0020_Name').value(fd.field('Driver_x0020_Lookup').control('data')['First_x0020_Name']);
fd.field('Last_x0020_Name').value(fd.field('Driver_x0020_Lookup').control('data')['Last_x0020_Name']);
fd.field('License_x0020_Number').value(fd.field('Driver_x0020_Lookup').control('data')['License_x0020_Number']);
fd.field('AppState').value(fd.field('Driver_x0020_Lookup').control('data')['AppState']);
fd.field('GW_x0020_Rejected').value(fd.field('Driver_x0020_Lookup').control('data')['GW_x0020_Rejected']);
fd.field('Date_x0020_of_x0020_Birth').value(fd.field('Driver_x0020_Lookup').control('data')['Date_x0020_of_x0020_Birth']);
fd.field('CDL_x0020_Year').value(fd.field('Driver_x0020_Lookup').control('data')['CDL_x0020_Year']);
fd.field('Driver_x0020_State').value(fd.field('Driver_x0020_Lookup').control('data')['Driver_x0020_State']);
fd.field('Address1').value(fd.field('Driver_x0020_Lookup').control('data')['Address1']);
fd.field('Address2').value(fd.field('Driver_x0020_Lookup').control('data')['Address2']);
fd.field('City').value(fd.field('Driver_x0020_Lookup').control('data')['City']);
fd.field('Zip_x0020_Code').value(fd.field('Driver_x0020_Lookup').control('data')['Zip_x0020_Code']);
//fd.field('License_x0020_State_x003a_ID').value(fd.field('Driver_x0020_Lookup').control('data')['License_x0020_State_x003a_ID']);
// fd.field('Beneficiary_x0020_First_x0020_Na').value(fd.field('Driver_x0020_Lookup').control('data')['AppState']);
}
However, 2 of those fields are drops downs:'
- one is a list selection (single)
- the other is a lookup fields
Neither of these fields populate. I checked the java syntax area and it seems as though it should work -however the values never change.
What am I doing wrong?
Fields: AppState (select) / Driver_x0020_State (lookup)
Help is deeply appreciated. It feels like I'm missing something small (not very experienced with java)
Code:
fd.field('Driver_x0020_Lookup').change(function(){
if(fd.field('Driver_x0020_Lookup').value().length > 0){
//retrieve your extra fields and populate fields on the form
fd.field('First_x0020_Name').value(fd.field('Driver_x0020_Lookup').control('data')['First_x0020_Name']);
fd.field('Last_x0020_Name').value(fd.field('Driver_x0020_Lookup').control('data')['Last_x0020_Name']);
fd.field('License_x0020_Number').value(fd.field('Driver_x0020_Lookup').control('data')['License_x0020_Number']);
fd.field('AppState').value(fd.field('Driver_x0020_Lookup').control('data')['AppState']);
fd.field('GW_x0020_Rejected').value(fd.field('Driver_x0020_Lookup').control('data')['GW_x0020_Rejected']);
fd.field('Date_x0020_of_x0020_Birth').value(fd.field('Driver_x0020_Lookup').control('data')['Date_x0020_of_x0020_Birth']);
fd.field('CDL_x0020_Year').value(fd.field('Driver_x0020_Lookup').control('data')['CDL_x0020_Year']);
fd.field('Driver_x0020_State').value(fd.field('Driver_x0020_Lookup').control('data')['Driver_x0020_State']);
fd.field('Address1').value(fd.field('Driver_x0020_Lookup').control('data')['Address1']);
fd.field('Address2').value(fd.field('Driver_x0020_Lookup').control('data')['Address2']);
fd.field('City').value(fd.field('Driver_x0020_Lookup').control('data')['City']);
fd.field('Zip_x0020_Code').value(fd.field('Driver_x0020_Lookup').control('data')['Zip_x0020_Code']);
//fd.field('License_x0020_State_x003a_ID').value(fd.field('Driver_x0020_Lookup').control('data')['License_x0020_State_x003a_ID']);
// fd.field('Beneficiary_x0020_First_x0020_Na').value(fd.field('Driver_x0020_Lookup').control('data')['AppState']);
}