Fix duplicated 'back_url' IDs

Various hidden input fields are used to hold a URL to send the user back
to the correct page after submitting a form, however, they all use the
same ID which isn't allowed in HTML. Passing in 'id' as nil stops the
'hidden_field_tag' from adding an ID attribute to the tag.
This commit is contained in:
Andrew Smith 2012-02-26 11:42:25 +00:00 committed by Felix Schäfer
parent 2a70e2704f
commit b15e6d8305
3 changed files with 3 additions and 3 deletions

View File

@ -851,7 +851,7 @@ module ApplicationHelper
def back_url_hidden_field_tag
back_url = params[:back_url] || request.env['HTTP_REFERER']
back_url = CGI.unescape(back_url.to_s)
hidden_field_tag('back_url', CGI.escape(back_url)) unless back_url.blank?
hidden_field_tag('back_url', CGI.escape(back_url), :id => nil) unless back_url.blank?
end
def check_all_links(form_name)

View File

@ -1,6 +1,6 @@
<div id="nav-login-content">
<% form_tag({:controller => "account", :action=> "login"}) do %>
<%= hidden_field_tag('back_url', CGI.escape(request.url)) %>
<%= hidden_field_tag 'back_url', CGI.escape(request.url), :id => nil %>
<table>
<tr>
<td><label for="username-pulldown"><%= l(:field_login) %></label></td>

View File

@ -1,5 +1,5 @@
<% form_tag({}) do -%>
<%= hidden_field_tag 'back_url', url_for(params) %>
<%= hidden_field_tag 'back_url', url_for(params), :id => nil %>
<div class="autoscroll">
<table class="list issues">
<thead><tr>