[Ruby] ruby on rails, formatting check_box
Jordan Isip
jordanisip at yahoo.com
Thu Aug 2 00:38:47 PDT 2007
You just have to throw the html options into another hash. For example:
<label>Validated?</label> <%= check_box("post", "validated", {:id=>"validations",:class=>"extreme"})%>
Becomes:
<label>Validated?</label> <input class="extreme" id="validations" name="post[validated]" value="1" type="checkbox"><input name="post[validated]" value="0" type="hidden">API:
check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0")
Good luck,
Jordan
----- Original Message ----
From: Frank Schwieterman <fschwiet at gmail.com>
To: Seattle Ruby Brigade! <ruby at zenspider.com>
Sent: Thursday, August 2, 2007 12:33:05 AM
Subject: Re: [Ruby] ruby on rails, formatting check_box
I tried dave's suggestoin (<label><%= checkbox>text</label>) and it does
what I had hoped. I'm interested in trying the CSS approaches too, but I'm
not sure how to add CSS to the <%= checkbox %>. I could bind the CSS to the
element type, but then it would affect all element types. I could bind it
to the element id, but then I'd be putting a dependency on the form helper's
conventions for making up those names (which could change). I could bind it
to the class name, but I don't know how to cause the <%= checkbox %> to have
a particular class name.
On 8/1/07, shane becker <veganstraightedge at gmail.com> wrote:
>
>
> > Usually, it's best to wrap your input with the label, so:
> > <label for='content_segment_needs_review'>
> > <input id='content_segment_needs_review' name='content_segment
> > [needs_review]' type='checkbox' value='1' />
> > Needs review
> > </label>
>
> i don't think that's the way it goes. i'm pretty sure it goes like this:
> <label for="your_face">Label</label>
> <input id="your_face" name='your_mother[your_face]' value='1' />
>
> http://www.w3schools.com/tags/tag_label.asp
>
>
> > To get line breaks to handle the way you want you, might try using
> > some CSS,
> > specifically: label{ white-space: nowrap }. Might work. Haven't
> > tried it.
>
> white-space is a goofy attribute. i would give these two a try.
> { display: inline }
> { display: block }
>
>
> good luck.
> -shaners
>
>
>
>
>
> -----------
> join the resistance. fall in love.
> http://theresistancearmy.com
>
>
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>
_______________________________________________
Ruby at zenspider.com - Seattle.rb non-commercial list
http://www.zenspider.com/seattle.rb
http://www.zenspider.com/mailman/listinfo/ruby
More information about the Ruby
mailing list