[web2py] Re: update table as boolean.

2015-04-07 Thread 黄祥
perhaps you can do it on application form level using onvalidation
e.g.
def __onvalidation_employee(form):
if form.vars.is_auth == 'on':
if form.vars.auth_user:
row = db(db.auth_user.id == form.vars.auth_user).select().first()

form.vars.first_name = row.first_name
form.vars.last_name = row.last_name
form.vars.email = row.email
 db(db.auth_user.id == form.vars.auth_user).update(status = T('Permanent') )
else:
form.errors.auth_user = T('Enter a value')
else:
if not form.vars.first_name:
form.errors.first_name = T('Enter a value')
elif not form.vars.last_name:
form.errors.last_name = T('Enter a value')

def employee():
grid = SQLFORM.grid(db.employee, onvalidation = __onvalidation_employee)
return locals()

best regards,
stifan

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: update table as boolean.

2015-03-31 Thread Anthony
Do you have a question? Any code to show?

On Tuesday, March 31, 2015 at 6:27:12 PM UTC-4, archana subramanyam wrote:

 Hi
 When i click on check box and confirm button ...the db with colo 'X' must 
 get updated to true (if checkbox is checked),else updted to false(if 
 checkbox not checked and on submitting 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.