Javascript+partial form problem

Hi,

Can anybody tell me how to pass a value to a javascript function from a partial form. I have done client side validation from rhtml pages having forms in the following manner :

<TD><%= f.text_field :first_name, :onChange => ("return checkName(this.form.first_name.value');") %></TD>

But since in a partial form there is not form tag, how can i pass the value to a javascript function?

-Thanks Saurav

Hi,

Can anybody tell me how to pass a value to a javascript function from a partial form. I have done client side validation from rhtml pages having forms in the following manner :

<TD><%= f.text_field :first_name, :onChange => ("return checkName(this.form.first_name.value');") %></TD>

But since in a partial form there is not form tag, how can i pass the value to a javascript function?

Surely if you've got f (which I assume is a form builder) then this partial will always be rendered inside a form? It doesn't matter if the form is inside the partial or not, the browser will never know. However, in your onChange 'this' should be the text field so this.value should work.

Fred