form.process(dupe_check).accepted:

*should be*

orm.process(onvalidation=dupe_check).accepted:


On Monday, 16 December 2013 20:04:02 UTC-6, Michel Hayek wrote:
>
> I'm getting an error on this (*the error is "<type 
> 'exceptions.TypeError'> process() takes exactly 1 argument (2 given)"  **on 
> if form.process(dupe_check).accepted:*). 
> here is what my files looks like
>
> *db.py:*
> *db.define_table('user_company',*
> *  Field('user_id', 'reference auth_user'),*
> *  Field('company_id', 'reference t_companies')*
> *  )*
>
> *default.py: (controller)*
> def lists():
>     grid = SQLFORM.grid(db.user_company)
>
> def dupe_check(form):
>     if db((db.company_user.user_id==request.args(-1)) & 
> (db.company_user.company_id==form.vars.company_id)).count():
>         form.errors['company_id'] = 'Company already associated with this 
> user.'
>
> @auth.requires_login()
> def usercompanies():
>     skip_these_records_query = db.user_company.user_id != request.args(-1)
>     
> db.user_company.company_id.requires=IS_IN_DB(db(skip_these_records_query), '
> t_companies.id', '%(f_coname)s', zero='Pick a company')
>     form=SQLFORM(db.user_company)
>     if form.process(dupe_check).accepted:
>         redirect(URL(r=request))
>         grid = SQLFORM.grid(db.user_company)
>         divi=SQLFORM.grid(db.user_company)
>     return dict (form=form, divi=divi)
>
> Thanks
>
> *This e-mail is confidential and may also be privileged. If you are not 
> the intended **recipient, please notify the sender immediately, delete it 
> from your system and do **not copy, disseminate, distribute or disclose 
> any information contained therein.*
>

-- 
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/groups/opt_out.

Reply via email to