Get Task from Project

How to get Task from Project selected through a dropdown.If a project is selected I need another dropdown with task belongs to that doctype
Thanx in advance.

Create 2 link fields for Project and Task.

And write a set_query() function for Task to get filtered results based on selected Project. Check existing code for set_query examples.