I'm constructing a simple form in ERB but the HTML produced by the text_field tag makes the for attribute in the label tag invalid.
<div>
<p><%= label_tag "email[name]", "Name" %></p>
<%= text_field :email, :name, :class => "text_field" %>
</div>
Produces the HTML
<div>
<p><label for="email[name]">Name</label></p>
<input class="text_field" id="email_name" name="email[name]" size="30" type="text" />
</div>
Which results in the error
character "[" is not allowed in the value of attribute "for".
How do I generate the text with without the nested parameter name email[name] to change the label tag for attribute? Is there an alternative approach that produces valid HTML?