Skip to content

Escaped javascript output appearing in html  #4

@davesmylie

Description

@davesmylie

Livevalidation seems to have broken with rails 2.3.8 - the javascript returned is now being passed thru the ERB::Util.h() function and the <script> tags turned into & lt;script& gt; tags.

This seems to be because the form helpers now return an ActiveSupport::SafeBuffer instead of a String, causing the concatenation of the generated javascript to passed thru h()

The fix is relatively simple - the javascript just needs to be marked as html_safe. In lib/form_helper.rb

def live_validations_for(object_name, method)
    script_tags(live_validation(object_name, method))
end

should be:

def live_validations_for(object_name, method)
    script_tags(live_validation(object_name, method)).html_safe
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions