1
votes

I have a form (Rails) and want to separate the submit into a separate DIV from the form fields:

.row
  .span
    = form_for [@household, @payment], do |h|
      %fieldset
        = h.label :lastname
        = h.text_field :lastname
        -# etc etc

  .span
    = h.submit "Submit"

Haml indentation rules say the "submit" tag has to be 2 spaces from the ".span". But this breaks the form, which expects it to be indented on the same level as the "%fieldset".

How can I make this form split itself over two DIVs?

1
Are you seriously intending to create <div class="span"> in your output? :/Phrogz
Heh no, that was a typo. I was trying to add a "span4" from the Twitter Bootstrap framework.thermans

1 Answers

1
votes

Try this to put your submit outside the fieldset:

.row
    = form_for [@household, @payment], do |h|
        %fieldset.span
            = h.label :title
            = h.text_field :title
            -# etc etc

        .span
            = h.submit "Submit"

BTW, if you think that there isn't possible way to make you template more concise then take a look at slim.