Playing around with merb-parts & I'm having some issues rendering my
contact form. When I try to use haml the output puts the form tags
beneath the form fields instead of around them.
When I use erb I end up with two copies of the the form, one of which
doesn't have a form field wrapped around it.
Any help is much appreciated.
Here is the source for the part I'm using:
class ContactFormPart < Merb::PartController
def new
@contact = Contact.new
@redirect_to = params[:redirect_to]
render
end
end
And the call to the part (haml):
#sidebar
= part ContactFormPart => :new, :redirect_to => url(:about)
And the new.html.erb template/output:
<%= form_for(@contact, :action => url(:contacts)) do -%>
<p>
<%= text_field :name, :label => 'Full Name' %>
</p>
<p>
<%= text_field :email, :label => 'Email' %>
</p>
<p>
<%= submit "Save", :class => 'button' %>
</p>
<p>
<%= hidden_field :name => :redirect_to, :value => @redirect_to %>
</p>
<%- end =%>
<div id='sidebar'>
<p>
<label for="contact_name">Full Name</label><input type="text"
value=" " class="text" name="contact[name]" id="contact_name"/>
</p>
<p>
<label for="contact_email">Email</label><input type="text"
value="" class="text" name="contact[email]" id="contact_email"/>
</p>
<p>
<input type="submit" value="Save" class="button" name="submit"
id="submit"/>
</p>
<p>
<input type="hidden" value="/about" class="hidden"
name="redirect_to" id="redirect_to"/>
</p>
<form method="post" action="/contacts">
<p>
<label for="contact_name">Full Name</label><input type="text"
value=" " class="text" name="contact[name]" id="contact_name"/>
</p>
<p>
<label for="contact_email">Email</label><input type="text"
value="" class="text" name="contact[email]" id="contact_email"/>
</p>
<p>
<input type="submit" value="Save" class="button" name="submit"
id="submit"/>
</p>
<p>
<input type="hidden" value="/about" class="hidden"
name="redirect_to" id="redirect_to"/>
</p>
</form>
</div>
And the new.html.haml template/output
.mailing_list_signup
= form_for(@contact, :action => url(:contacts)) do
%p= text_field :name, :label => 'Full Name'
%p= text_field :email, :label => 'Email'
= hidden_field :name => :redirect_to, :value => @redirect_to
%p= submit "Save", :class => 'button'
<div id='sidebar'>
<div class='mailing_list_signup'>
<p>
<label for="contact_name">Full Name</label><input type="text"
value=" " class="text" name="contact[name]" id="contact_name"/>
</p>
<p>
<label for="contact_email">Email</label><input type="text"
value="" class="text" name="contact[email]" id="contact_email"/>
</p>
<input type="hidden" value="/about" class="hidden"
name="redirect_to" id="redirect_to"/>
<p>
<input type="submit" value="Save" class="button" name="submit"
id="submit"/>
</p>
<form method="post" action="/contacts">1</form>
</div>
</div>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---