Javascript+partial form problem


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 :

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

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


On Aug 26, 6:25 am, Saurav C. <rails-mailing-l…@andreas-> wrote:

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.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs