Hi Anthony,
Thanks for your reply.
I have a table named register:
db.define_table('register',
Field('nodeID', 'reference node', writable=False, readable=False),
Field('interfaceCategoryID', 'reference interface_category',
writable=False, readable=False),
...
migrate=False)
In the register function I have the following lines of code:
form=SQLFORM(db.register, labels=dict(agreedTaC='', agreedDirectDebit=''),
separator='', formstyle=bootstrap3)
bootstrap3 is a function in a module:
def bootstrap3(form, fields):
form.add_class('form-horizontal')
parent = FIELDSET()
for id, label, controls, help in fields:
if not help:
_help = ''
else:
# wrappers
_help = SPAN(help, _class='help-block')
# embed _help into _controls
_controls = DIV(controls, _help, _class='col-sm-6 controls')
# submit unflag by default
_submit = False
if isinstance(controls, INPUT):
if controls['_type'] not in ['file', 'checkbox', 'radio']:
controls.add_class('form-control')
if controls['_type'] == 'submit':
# flag submit button
_submit = True
controls['_class'] = 'btn btn-primary'
if controls['_type'] == 'file':
controls['_class'] = 'input-file'
# For password fields, which are wrapped in a CAT object.
if isinstance(controls, CAT) and isinstance(controls[0], INPUT):
controls[0].add_class('form-control')
if isinstance(controls, SELECT):
controls.add_class('form-control')
if isinstance(controls, TEXTAREA):
controls.add_class('form-control')
if isinstance(label, LABEL):
label['_class'] = 'col-sm-4 control-label'
if _submit:
# submit button has unwrapped label and controls, different
class
parent.append(DIV(label, controls, _class='col-sm-offset-4
col-sm-6 form-actions', _id=id))
# unflag submit (possible side effect)
_submit = False
else:
# unwrapped label
parent.append(DIV(label, _controls, _class='form-group',
_id=id))
return parent
The problem is that in a read only field its contents is aligned to the top
i.e it has no top
padding. I first solved the problem by adding a selector to my css file
based on the
label's id and the div's class. But, as I said I have more read only
fields, so I ended up
with a selector for every read only field. That's why I am looking for a
more generic
solution.
I hope I provided you with enough information to help me solve the problem.
Kind regards,
Annet
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.