form_for with divs and fieldsets => stupid

If I do this:

Something's going wrong because the form tag is not being generated at all. I'm surprised there's not an error though. The only thing pops out at me is the fact that you aren't passing an object to it. Typically form_for is called like:

form_for :item, @item, :url => .....

Where :item is the name, and @item provides the values for form persistence.

I don't claim to know why this is happening, but what happens when
you move the form_for into the partial?

Also, shouldn't you have fieldset inside your form_for?

<div class="form" id="form" style="display : none;">    <fieldset>        <%= render :partial => 'item_form', :locals => { :f => f } %>    </fieldset> </div>

I moved the div and the fieldset inside the form_for and it works. I just don't know why when I put the tags outside it doesn't get generated in the right place. I just want to know if there is a reason for this behavior. I also don't know why a form tag wasn't created. I never tried to submit anything when the form was displaying outside the fieldset.

Gabe: You only need to pass an object in if the form is going to be pre-populated. At least that is my understanding.

There is some refactoring being done. The divs and fieldsets and form_fors are being moved to the partial.

Wait, if you move the div and fieldset inside the form_for the form tags are being generated correctly? Or just the order comes out correct? The latter makes perfect sense, but the former would be exceedingly strange.

If I put the div and fieldset inside the form_for everything is correct. The form fields are inside the fieldset which in turn is inside the div, and everything forks great. If I place it as about everything shows up out of order. I'm using Rails 1.2.3 and Ruby 1.8.6.