Agree on some terms before registration

199 views
Skip to first unread message

Hassan Alnatour

unread,
Mar 29, 2012, 6:15:31 PM3/29/12
to web...@googlegroups.com
Dear ALL,

How can i make the user agree to some term using a check box before registration ??

Massimo Di Pierro

unread,
Mar 29, 2012, 8:06:24 PM3/29/12
to web...@googlegroups.com
add a boolean field to the registration page and require it to be true

auth.settings.custom_fields['auth_user'].append(Field('agree','boolean',requires=IS_NOT_EMPTY(error_message='you must agree this')))

Hassan Alnatour

unread,
Mar 30, 2012, 3:19:14 AM3/30/12
to web...@googlegroups.com
it works but its not showing any text next to the check box  , how can i show some text next to the check box ?

Simon Bushell

unread,
Mar 30, 2012, 5:06:19 AM3/30/12
to web...@googlegroups.com
How are you inserting the form into your view? If you're using SQLFORM you can supply labels to your fields (in your case the 'agree' field) using something like:

form = SQLFORM(db.auth_user, fields = ['agree'], labels = {'agree':'Do you agree to the Terms and Conditions?'})

Obviously you will need to add all the fields to the fields list you want to include in the form.

S

weheh

unread,
Mar 30, 2012, 6:52:34 AM3/30/12
to web...@googlegroups.com
Just add a label argument to Massimo's answer:

auth.settings.custom_fields['auth_user'].append(Field('agree','boolean',label='Abandon hope all ye who enter',requires=IS_NOT_EMPTY(error_message='you must agree this'))) 

Bruno Rocha

unread,
Mar 30, 2012, 7:45:18 AM3/30/12
to web...@googlegroups.com

custom_fields or extra_fields???

http://zerp.ly/rochacbruno

Massimo Di Pierro

unread,
Mar 30, 2012, 8:58:44 AM3/30/12
to web...@googlegroups.com
sorry extra_fields.

Hassan Alnatour

unread,
Mar 30, 2012, 2:52:36 PM3/30/12
to web...@googlegroups.com
auth.settings.extra_fields['auth_user']= [
  Field('Country',default="None"),
  Field('City',default="None"),
  Field('gender',requires=IS_IN_SET(genders,zero=None)),


# Trying to Show a massage new to the checkbox using this Field ..
  Field('agree','boolean',requires=IS_NOT_EMPTY(error_message='you must agree this'))
  ]

Gael Princivalle

unread,
Feb 18, 2017, 9:30:15 AM2/18/17
to web2py-users
Hello.

Here is a complete solution without the use of a custom form.

auth.settings.extra_fields['auth_user']= [
   
Field('agree_terms_and_conditions','boolean', label=T('I agree to terms and conditions'),default=False,requires=IS_NOT_EMPTY(error_message=T('You must agree the term conditions')),comment=XML(A(T('Read the terms and conditions'), _href=(URL('default', 'terms_and_conditions')), _target='blank')))
]

Marlysson Silva

unread,
Feb 21, 2017, 7:26:26 AM2/21/17
to web2py-users
Sorry to survive a so old topic , but a alternative solution is:
Reply all
Reply to author
Forward
0 new messages