On Feb 19, 8:54 pm, Jose <jjac...@gmail.com> wrote:
> how to this [1] with webpy?
>
> [1]http://www.vimeo.com/9526668

Here is complete code:

db.define_table('organization',Field('name',notnull=True,unique=True),format='%
(name)s')
db.define_table('person',Field('name'),Field('organization',db.organization))

db.person.organization.comment = \
    SPAN(A('add',_class='thickbox',
           _href="#TB_inline?
height=200&width=600&inlineId=modal_content"),
         DIV(LOAD('default','add_organization',ajax=True),
             _id='modal_content',_class='hidden'))

response.files.append('http://jquery.com/demo/thickbox/thickbox-code/
thickbox.js')
response.files.append('http://jquery.com/demo/thickbox/thickbox-code/
thickbox.css')

def index():
    return dict(form=crud.create(db.person,request.args(0)))

def add_organization():
    def update_select(form):
        organizations =
db(db.organization.id>0).select(orderby=db.organization.name)
        options = TAG['']
(*[OPTION(o.name,_value=o.id,_selected=form.vars.id==o.id) for o in
organizations])
        response.headers['web2py-component-command'] =
"jQuery('#person_organization').html('%s');jQuery('#TB_closeWindowButton').click()"
% options
    return crud.create(db.organization,onaccept=update_select)

-- 
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