Reducing the length of stupid Textfield

Is it possible to reduce the length of the text field in a form? I
used :size => 5, it does not reduce the size of text field shown on
the screen. It is very long. TIA.

Is it possible to reduce the length of the text field in a form? I
used :size => 5, it does not reduce the size of text field shown on
the screen. It is very long. TIA.

Odds are it’s being styled via CSS. Try adding:

:style => “width: 100px”

And see if that shortens it… if so, CSS is styling it and you’ll have
to
decide where to modify it.

-philip

[email protected] wrote:

Is it possible to reduce the length of the text field in a form? I
used :size => 5, it does not reduce the size of text field shown on
the screen. It is very long. TIA.

Use CSS Formatting to reduce the size of the textfield.

Is it possible to reduce the length of the text field in a form?
I used :size => 5

You need to put the size in quotes:
:size => “5”

hth,
Bill

:size => 5 in the options hash should work:

text_field_tag “name”, value = “”, options = {:size => 5}

That yields a text field with size 5 for me. So does:

f.text_field :first_name, {:size => 5}

Make sure there’s no CSS forcing the field to be longer.

Hope that helps…

I’m not sure that’s true, Bill. I’ve been using :size => 20 [any number
will
do] on my fields for months [if not longer] and they work just fine. It
even
autoconverts them to the quoted string values that are proper XHTML. I’m
using Edge Rails if that makes a difference.

RSL

It does not matter whether it is within double quotes. Thanks for the
help, the CSS was forcing the length to be constant. Checkout the CSS
Viewer plugin for Firefox, it is awesome. You just point at the field
and it shows a floating window shows you which css elements define it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs