I personally don't agree with using javascript to set properties like
that. I remove these lines from web2py_ajax.html:
jQuery('input.string').attr('size',50);
jQuery('textarea.text').attr('cols',50).attr('rows',10);
Then use custom widgets or just set the properties if the form
elements directly:
form = SQLFORM(...)
txt = form.elements("textarea",_class="text")
for t in txt:
t['_cols'] = 10
Or with a widget:
def textarea_factory(**attr):
def fn(f,v):
return SQLFORM.widgets.text.widget(f,v,**attr)
return fn
form = SQLFORM.factory(Field('test','text',widget=textarea_factory
(_cols=40,_rows=15)))
db.table.field.widget = textarea_factory(_cols=10)
On Nov 24, 9:00 pm, Gary <[email protected]> wrote:
> Sorry, missed the posting two down titled 'Length'.
>
> That solved the problem, but is there a more eloquent way not using
> JQuery?
>
> On Nov 24, 9:44 pm, Gary <[email protected]> wrote:
>
> > I expected the custom widget for strings to scale to the size of the
> > length specified in the ORM, but they all come out the same size - and
> > they're big.
>
> > Is there another place I should be entering something that helps me
> > with this? I've constructed a custom form using CRUD and the field
> > names are {{=form.custom.widget.fieldname}}.
>
> > Thanks in advance,
> > Gary
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---