Display text_field if checkbox checked

Hi!

I've been trying to figure out how to display a text_field if a
checkbox on my form is checked. If the checkbox is unchecked, the
text_field is removed.

If anybody has an example or tutorial on this, that would be great.
I'm going to do some more searching in google now and not the
group...but if anybody can help, that would be awesome.

Thanks,
mike

something like this ought to do it:

<%= check_box :foo, :box, :onclick =>
"document.getElementById('foo_bar').style.display = (this.checked ?
'inline' : 'none');" %>
<%= text_field :foo, :bar, :style => ((params[:foo] and params[:foo]
[:box] == '1') ? 'display:inline' : 'display:none') %>

Wow, thank you so very much. That worked!!!!

Thank you again, this will come in very handy!

Mike

I don't mean to be a pain...i'm really greatful that you took the time
to help me out.

But, is there also a way I can display a snippet of text when the
text_field pops up as well?

thanks again for your help!
mike

For others, I figured it out. It seems to work the same...