Yii & jquery mobile client validation


I am developing a mobile application with Yii and jQuery mobile and encountered the following problem:

I have a form I want to use client validation on, but this only works if i call the page directly.

If I navigate to the page normally, Yii inserts the javascript code in the body outside of the page div, so it gets dropped.

Is there any way to tell Yii where to put the validation code?

Any other suggestions?