On Tuesday, April 12, 2011 1:34:01 AM UTC-4, niknok wrote:
>
> This is how I use it right now.. Looking for a way to change
> 'instruction' field.
>
> form=SQLFORM.factory(
> Field('instruction','text', writable=False, default='Extra text to
> display'),
> Field('f1', 'string'))
Are you using 'instruction' as a dummy field just to display an instruction
right above the form? If so, you can instead manipulate the form on the
server side to insert an instruction. See
http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-to-SQLFORM,
http://www.web2pyslices.com/main/slices/take_slice/43, and
http://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing. For
example, you could do:
form=SQLFORM.factory(Field('f1', 'string'), Field('f2', 'string'))
form.element('table').insert(0, TR(TD(T('Instruction text centered above
the form'),
_style='text-align:center', _colspan='2')))
Or, instead of inserting the instruction in a table row, you could just wrap
the form in a DIV and add the instruction above the form:
form=DIV(SPAN(T('Instruction text above the form')), form)
Anthony