Inline scripts fail unless primary javascripts included beforehand? #257

Closed
sethbro opened this Issue Jan 24, 2012 · 2 comments

Projects

None yet

3 participants

@sethbro
sethbro commented Jan 24, 2012

I got everything installed & included just fine, but then encountered JS errors (ClientSideValidations isn't defined) since client_side_validations outputs an inline script below the form it's validating. I include all scripts at the bottom of pages, which is pretty standard practice, so I'm curious if there's a way around this. I browsed previous issues but found no mentions.

@MSchmidt

+1, seems like a new issue since 3.2 beta

@bcardarella
Contributor

If you call the form with any other positive value for :validate other than true it assigns the script tag to content_for for that name. So for example:

<%= form_for @user, :validate => :user do |f| %>

will not render the script tag inline but assign it to content_for(:user) that you can then user anywhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment