This project is archived and is in readonly mode.
Patch to add html options to the div that wraps the authenticity_token input field
-
chris finne
patch file attached
-
chris finne
patch file attached
-
Cristi Balan
I think just having a display: inline on the div, or using a span tag, would solve most of the layout issues.
Also, I recently came across an issue with this when the form had display: inline and the div caused a linebreak. However, this is sometimes fixable. I was able to style that by adding a class on the form because I didn't have other divs in there:
form.blah div { display: inline }
-
Philip Hallstrom
- Tag changed from form_for, form_tag, form_tag_helper, patch to authenticity_token, form_for, form_tag, form_tag_helper, patch
I just ran into this myself. In looking into it I began to wonder why the hidden field is wrapped in a tag at all? My understanding is that hidden fields are inline and don't take up any room in the layout by default so why wrap it?
At the very least the div tag should have a class added to it and/or have display:none set to remove it from the layout completely.
But unless there is a reason to wrap it in the first place, why not simply remove the div wrapper entirely?
-
Philip Hallstrom
This patch works on the following:
Rails version 2.3.2 Edge Rails revision 165d9f13ce4212468b5c2399e0560f23444d9590
-
chris finne
I don't know the specifics by heart, but my FireFox HTML validator plugin complains if I have an INPUT tag inside a form that isn't wrapped by a DIV or P tag.
-
Arthur Klepchukov
Looks good +1
-
Babar O'Cap
+1
-
Ignacio Carrera
what about simply adding :class => "authenticityTokenWrapper" so you can style it as you like with plain old CSS?
-
ivanoats
+1 to nachokb
-
ivanoats
Although, you can already use CSS to select by the name attribute of the element:
form#new_model div input[name="authenticity_token"] { display: none; background-color: #fff;} -
Philip Hallstrom
We need to be able to target the DIV though, not the hidden input within it.
-
ivanoats
Ok, yeah, I definitely see that. It would be an improvement to have an id on it. I guess you could do this:
form#new_model div[style="margin: 0pt; padding: 0pt; display: inline;"]but that seems kinda creaky and not future-proof. It should be by design. The above is just another work-around.
-
adevadeh
we've run into the same issue. worked around by copying the output of the form helper into the view, replacing the urls with url_for, and deleting the wrap around div (we have our own div). I would prefer the simple solution of including a className in order to style if needed.
-
billyjr
Yup, including a className would be the best solution for most of the cases.
-
Joff Williams
"The div is for HTML4.01/XHTML1.0 strict compliance." There's more info about this in the old Rails Trac: http://dev.rubyonrails.org/ticket/10422.
Adding inline margin/padding is bad practice as it doesn't separate markup from style.
Although not a perfect solution, my vote would be to add :class => "authenticityTokenWrapper" and perhaps display:none as the default. -
rails
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails
- State changed from open to stale
