Client Script to list values from a child doctype into a field when a customer is selected

I need a script to get a value from a child table of a doctype into a field in another doctype when a dependent field is selected. below is the issue i want to solve.

I have a child table in Customer Doctype named (Pupil Table) and the child table has the following field

Student linked to student doctype and
Student Name- read only.

This table has been populated with students 9Student A and Student B) who are related to the customer as shown below;

Now i have a custom field in Sales Invoice (select Child) which is linked to the student doctype.

What i want to achieve is this. In sales Invoice, when a customer is selected, the field (select child) should display only the students names in the child table of that customer which has already being populated in the customer doctype.

i appreciate your anticipated help on this