1

If have a textfield defined as Field('title', 'text', label = T('Please enter something:')). It is rendered as a textarea.

Is it possible to pass some custom-parameters for this field like rows="5"in <textarea rows="5" name="title" .... ></textarea>

I mean the easy way, without writing a custom widget.

Rockbot
  • 935
  • 1
  • 6
  • 24

2 Answers2

2
Field('title', 'text', label=T('Please enter something:'),
      widget=lambda f, v: SQLFORM.widgets.text.widget(f, v, _rows=5))

For more details, see the relevant section in the documentation.

Anthony
  • 25,466
  • 3
  • 28
  • 57
1

There is a similar answer here: Custom CSS Classes for widgets

This answer also applies to my question: instead if passing ['_class] = "bla" just pass ['_rows'] = "x"

Community
  • 1
  • 1
Rockbot
  • 935
  • 1
  • 6
  • 24