Hi Mengu,

> i was just wondering if it is possible to add a custom form element
> like an input or a drop down box to a crud.create. i also would like
> to know how sqlform is different than crud.

I don't know if this what you're looking for, but I needed a custom
drop
box in a crud.create and a crud.update form, I added the following
line
to the function:

activity=activity_rowset()
db.timetable.activity.requires=IS_IN_SET([row.activity for row in
activity])

The entire function reads like:

@auth.requires_membership('site_manager')
def create_timetable():
    response.view='default/form.html'
    response.flash='Insert class'
    db.timetable.company.default=auth.user.company
    activity=activity_rowset()
    db.timetable.activity.requires=IS_IN_SET([row.activity for row in
activity])
    form=create_form(db.timetable,message='Class inserted')
    return dict(form=form)


create_form is a custom function in which I add a reset and canel
button to
the from, I guess that answers the first part of your question:

def create_form(table,message):
    form=crud.create(table,message=message)
    form[0][-1][1].append(INPUT(_type="reset",_value="Reset"))
    form[0][-1][1].append(INPUT
(_type="button",_value="Cancel",_onclick="javascript:history.go(-1)"))
    return form


I hope this will point you in the right direction.

Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to