The chain rule needs to be applied when you are differentiating a function f of x with respect to a variable t, x is a function of (i.e. given f(x) and x(t), you want to calculate df/dt.
To do so you will have to do as follows: df/dt = df/dx * dx/dt.
This will take you to the right solution.