appended add-on not visible

23 views
Skip to first unread message

macsig

unread,
Oct 26, 2012, 1:14:31 AM10/26/12
to SimpleForm
Hello there.
Following what I have found here http://simple-form-bootstrap.plataformatec.com.br/articles/new

f.input :disabled_text, :wrapper => :prepend, :hint => "This is the
hint text" do
content_tag :label, :class => "add-on" do
check_box_tag :remove, 'true'
end
f.input_field :disabled_text
end



I'm trying to add to my form a text field with an appended checkbox
using the code below:

f.input :password, :wrapper => :append, :label => "localize it" do
content_tag :label, :class => "add-on" do
check_box_tag
end
f.input_field :password
end

However I don't see the appended checkbox. I can see that some styling
has been applied to the input_field since the right corners are not
longer rounded but the appended area is not visible.

While I was trying to make it work I inverted the elements inside the
input block as below


f.input :password, :wrapper => :append, :label => "localize it" do
f.input_field :password
content_tag :label, :class => "add-on" do
check_box_tag
end
end


and now I see the appended are abut not the input field.

Am I missing something here?

Thanks and have a nice day.

macsig

unread,
Oct 26, 2012, 1:20:04 AM10/26/12
to SimpleForm
Forgot to mention I'm using simple_form (2.0.4) and twitter-bootstrap-
rails (2.1.3)

Thanks

Carlos Antonio da Silva

unread,
Oct 28, 2012, 11:23:58 AM10/28/12
to plataformate...@googlegroups.com
Are you using ERb or HAML? Depending on the way they're used, they'll only render the last element (the return from the given block).

In ERb it usually doesn't happen because it uses capture internally, so that might be the problem. You may have to manually concatenate the elements you want to display, making them one result.
--
At.
Carlos Antonio

macsig

unread,
Oct 29, 2012, 3:37:20 AM10/29/12
to plataformate...@googlegroups.com
Hi Carlos.
Thanks for your reply.

I'm using erb but not sure what is the issue here since my code is basically the same posted in the blog I mentioned an the beginning and there the code works.

How may i concatenate them? Just put one into the other?

Thanks again.
Reply all
Reply to author
Forward
0 new messages