0

I'm having an issue where the form generated with ruby isn't included inside my #content div, is this because the form is generated after the html is read by the browser (sorry if I sound like a moron on this)

-- edit update - view source --

The code below generates with the email box and submit button outside of the content box

<div id="content">
<!-- text here -->
<form accept-charset="UTF-8" action="/password_resets" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="&#x2713;" />
<input name="authenticity_token" type="hidden" value="afmtpSAc93w1uMcnouhY9XmbVTM7fE1VNFvZKnp0kMs=" />
</div>
    <div class="field"> 
        <input id="email" name="email" placeholder="email@website.com" type="text" />
    </div>
    <div class="actions">
        <input name="commit" type="submit" value="Reset Password" />
</form> </div>
</div>
andy.d
  • 1
  • 1
  • `<% end -%>` May be this is causing the issue. Try changing it to `<% end %>`. – ShaggyInjun Jun 30 '12 at 01:02
  • 1
    No, erb is server-side. It is procesed before anything is sent to the browser. What output do you get? – Mark Thomas Jun 30 '12 at 01:43
  • Are you sure it is actually outside the box *in the source*? Else it might be that you have floating elements which do not add height to #content. Anyways, please check the HTML output by doing "View Source" (rather than "Inspect Element") in your browser of choice. – dschooh Jun 30 '12 at 15:27

2 Answers2

0

I'm not sure I got the question right, but in the html above the last </form> </div> should be </div> </form>

davidrac
  • 10,723
  • 3
  • 39
  • 71
  • right, but this is the original code, pre-ruby compile. also is there a way to make this block instead of inline in comments? `

    Forgot your password?

    Happens to me all the time.

    Enter your email address and we'll send you instructions to change your password

    <%= form_tag password_resets_path, :method => :post do %>
    <%= text_field_tag :email, params[:email], :placeholder => "email@website.com" %>
    <%= submit_tag "Reset Password" %>
    <% end -%>
    `
    – andy.d Jul 02 '12 at 19:30
  • actually it goes div content > form > div's for inputs > /divs > /form > /div content. the div's inside the form aren't rendering as part of the content div...I could give the content div a height that includes those inputs, but that's more of a bandaid than a solution – andy.d Jul 02 '12 at 19:40
  • any reason for <% end -%> and not <% end %> ? – davidrac Jul 02 '12 at 20:02
0

figured it out after visiting this link Is it correct to use DIV inside FORM?

once I removed the div's for field and action it cleared everything up

Community
  • 1
  • 1
andy.d
  • 1
  • 1