Dependent select in nested attributes

Hello people.

I have a problem with this. I've followed this tutorial
http://www.petermac.com/rails-3-jquery-and-multi-select-dependencies/
and I can have a dependent select. But it works just if the fields
belongs to the same form.

But in my app I have a model call "invoices", in the "main form" I
choose the provider, then, using the nested attributes, I choose
"many" waybills. But the collection select where I display the
waybills, shows all the waybills. So the idea is just show the
waybills that belongs to the provider selected previously.

I'm using rails 3.0.9 with jquery

Hope you can help me, thanks