Plumsail Forms: Lookup DropDown populates other field upon selection

Thanks for the reply, im a bit of a novice when it comes to this but im getting there so thanks for the help

These are the internal names for the columns -

Course Start Date = Coursedate
Location of Course = Locationofcourse
Course Finish Date = CourseFinishDate
Trainers = Trainers

are you okay to show me what to do next?

Thanks
Jacob

@Jacob_Simons,

You are doing great so far!)

Now you need to list internal names in the Extra Fields property of Training Course lookup, like this:
image

Once done, update the below code (read my comments) and add it to the JavaScript editor:

//all code that you want to be executed when the form is loaded
// or when user fill out the form must be inside spRendered() function
fd.spRendered(function() {

	//function to populate Course Details
	function populateCourseDetails() {
		//Replace CourseLocation, CourseStartDate, and TrainingCourse with internal names of the fields on the form, see the screenshot below
		//As I understand, the Training Course lookup is a control; if it is a SharePoint field, replace control with field
		//add similar lines for other fields
		fd.field('CourseLocation').value = fd.control('TrainingCourse').value.Locationofcourse;
		fd.field('CourseStartDate').value = fd.control('TrainingCourse').value.Coursedate;
	}

	//call the function to populate Course Details when lookup value changes
	fd.control('TrainingCourse').$on('change', populateCourseDetails);

	//call the function to populate Course Details when opening the form
	//if you don't need to populate details on form load, delete this lines
	fd.control('TrainingCourse').ready().then(function(control) {
		populateCourseDetails();
	});

});

image

If you've done it all and it still doesn't work, please share the code and the screenshot of the errors from the browser's console(F12):

@Jacob_Simons,

Please change update this line of the code:

//call the function to populate Course Details when lookup value changes
fd.control('Control').$on('change', populateCourseDetails);

It should be:
fd.control('TrainingCourse').$on('change', populateCourseDetails);

GOT IT TO WORK!!! thanks so much for your help!

1 Like