Hi Massimo,

>You are asking to make a guess about your code.

It is a lot of code and the main point is I use GAE datatable.

In order to use web2py I use SQLFORM.factory, then in
form.process(formname='myinfo').accepted
I get the values, assign to GAE table instance and use GAE .put() to store 
them.

So the bottom line I use SQLFORM.factory to generate a virtual table:

form = SQLFORM.factory(
                            Field('first_name', requires=IS_NOT_EMPTY() ),
                            Field('last_name', requires=IS_NOT_EMPTY() ),
                            Field('job_title'),
                            Field('org_name'),
                            Field('email_work', requires=[IS_NOT_EMPTY(), 
IS_EMAIL(error_message='invalid email!')]),
                            Field('email_home', requires = 
IS_EMPTY_OR(IS_EMAIL(error_message='invalid email!'))),
                            Field('primary_email_choice', 
widget=SQLFORM.widgets.radio.widget, requires=IS_IN_SET({'Work' : 'Work', 
'Home' : 'Home'})),
                            Field('phone_mobile'),
                            Field('phone_work', requires=IS_NOT_EMPTY() ),
                            Field('phone_home'),
                            Field('primary_phone_choice', 
widget=SQLFORM.widgets.radio.widget, requires=IS_IN_SET({'Mobile' : 
'Mobile', 'Work' : 'Work', 'Home' : 'Home'})),
                            Field('fax_work'),
                            Field('fax_home'),                            
                            Field('website_work'),
                            Field('website_blog'),
                            Field('website_home'),                         
   
                            Field('structured_postal_address_work'),
                            Field('structured_postal_address_home'),       
                                                
                            submit_button = 'Submit'                       
     

# fields is a dictionary populated after reading from GAE datastore.

form.vars.first_name = fields['name_first']
form.vars.last_name = fields['name_last']
form.vars.job_title = fields['job_title']
# etc.etc.


 if fields['job_title'] == JOB_TITLE_DEFAULT:
        form.vars.job_title = ''
else:    
        form.vars.job_title = fields['job_title']
# etc.etc.

form.custom.submit['_data-theme'] = 'b'
#############################################
# accepted
#############################################
if form.process(formname='myinfo').accepted:   

<-- the execution does not hit it after .accepted - e.g. .accepted does not 
recognizes the form submission and the code cannot process form.vars from 
the form

     name_first=form.vars.first_name
     name_last=form.vars.last_name
     job_title=form.vars.job_title
    if not job_title:
        job_title = JOB_TITLE_DEFAULT
# etc.etc.




Reply via email to