in model:
db.define_table('info',
Field('info_id', default=auth.user_id, writable=False,
readable=False),
Field('dp','upload',label='Update your profile pic'),
Field('first_name',requires=IS_NOT_EMPTY(error_message="Please fill it")),
Field('last_name',requires=IS_NOT_EMPTY(error_message="Please fill it")),
Field('dob','date',
default=request.now,requires=IS_NOT_EMPTY(error_message="Please fill it"),
label='Date of Birth'),
Field('sex',requires=IS_IN_SET(['Male','Female','Other'],error_message="Please
fill it")),
Field('hometown',requires=IS_NOT_EMPTY(error_message="Please fill it")),
Field('highschool', label='High School'),
Field('university'),
Field('oneself', 'text', label='Write about yourself'),
)
in controller:
@auth.requires_login()
def screen():
row=db(db.info.info_id==auth.user_id).select().first()
return locals()
def delformforscreen():
row=db(db.info.info_id==auth.user_id).select().first()
form=SQLFORM(db.info,row.id).process()
submit=form.element("input",_type="submit")
submit["_onclick"]="return confirm('Are you sure');"
return locals()
My views:
in default/screen.html:
{{extend 'layout.html'}}
<h1>Hi {{=row.first_name}}!</h1>
<br>
<img src="{{=URL('download',args=row.dp)}}">
{{=LOAD('default', 'delformforscreen.load', ajax=True)}}
in delformforscreen.load:
<script>
jQuery(document).ready(function(){
jQuery('#info_id__row').hide();
});
</script>
{{=form}}
--
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/d/optout.