Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering a form #9

Open
JakeAustwick opened this issue Feb 27, 2014 · 3 comments
Open

Rendering a form #9

JakeAustwick opened this issue Feb 27, 2014 · 3 comments

Comments

@JakeAustwick
Copy link
Contributor

Since the gem has been updated to use your version of erector, then the documentation is out of date.

<%= Formbuilder::FormRenderer.new(@form, @entry).to_html %>

Is no longer valid. From what I understand, for the following line should work within the view:

<%= Formbuilder::Views::Form.new(:form => @form, :entry => @entry).to_html %>

However that gives the error: undefined method form_tag' for nil:NilClass`.

I was able to get rid of the error, and get the form to render on the view with:

<%= Formbuilder::Views::Form.new(:form => @form, :entry => @entry).to_s(:parent => self) %>

However I don't think this is necessary? and it also still doesn't actually work. The output html it generates has the fields, and then an empty form tag afterwards.

<div class="fb-field-wrapper response-field-paragraph ">
   <label for="response_fields_24">bbb <abbr title="required">*</abbr></label>
   <textarea class="rf-size-small" id="response_fields_24" name="response_fields[24]">
</textarea>
   <div class="clear"></div>
</div>
<div class="fb-field-wrapper response-field-paragraph ">
   <label for="response_fields_25">Untitled <abbr title="required">*</abbr></label>
   <textarea class="rf-size-small" id="response_fields_25" name="response_fields[25]">
</textarea>
   <div class="clear"></div>
</div>
<div class="fb-field-wrapper response-field-text ">
   <label for="response_fields_23">aaa <abbr title="required">*</abbr></label><input class="rf-size-small" id="response_fields_23" name="response_fields[23]" type="text" />
   <div class="clear"></div>
</div>
<div class="form-actions"><button class="button primary">Submit</button></div>
<form accept-charset="UTF-8" action="" class="formbuilder-form" enctype="multipart/form-data" method="post">
   <div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="zfiZ2/iyIh95qQGQ2Eu3H5VrgleFSKIY5/JDaWsfYQ8=" /></div>
</form>

What am I doing wrong?

@jcutrell
Copy link

I'm seeing this issue as well. Been looking into it - looks like it's coming from Erector's Rails compatibility conventions. Not sure what's causing it ultimately.

I'm also seeing the exact same behavior, with the form rendering after the fields.

@ajb
Copy link
Contributor

ajb commented Jun 11, 2014

I've opened the issue above in Erector.

@Sen
Copy link

Sen commented Nov 2, 2014

@ajb same bug here, already using the master branch of Erector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants