is it related to the other field constructor, like required, label, etc? 
and for controller i'm using grid.

*default.py*
@auth.requires_login()
def contact():
    grid=SQLFORM.grid(db.contact, user_signature=False)
    return locals()

*db_wizard.py*
# create table : contact
db.define_table('contact',
    Field('salutation'),
    Field('first_name'),
    Field('last_name'),
    Field('gender', 'list:string'),
    Field('birthday', 'date'),
    Field('job_title'),
    Field('address', 'text'),
    Field('zip'),
    Field('city'),
    Field('country'),
    Field('phone'),
    Field('fax'),
    Field('email'),
    Field('account', 'reference account'),
    format='%(first_name)s %(last_name)s')

# create index : contact
db.executesql('CREATE INDEX IF NOT EXISTS idx_contact ON contact (id, 
first_name, last_name);')

# enable_record_versioning : contact
db.contact._enable_record_versioning()

*db_wizard_label.py*
# contact
db.contact.salutation.label=T('Salutation')
db.contact.first_name.label=T('First Name')
db.contact.last_name.label=T('Last Name')
db.contact.gender.label=T('Gender')
db.contact.birthday.label=T('Birthday')
db.contact.job_title.label=T('Job Title')
db.contact.address.label=T('Address')
db.contact.zip.label=T('Zip')
db.contact.city.label=T('City')
db.contact.country.label=T('Country')
db.contact.phone.label=T('Phone')
db.contact.fax.label=T('Fax')
db.contact.email.label=T('Email')
db.contact.account.label=T('Account')

*db_wizard_required.py*
# contact
db.contact.salutation.required=True
db.contact.first_name.required=True
db.contact.last_name.required=True
db.contact.gender.required=True
db.contact.job_title.required=True
db.contact.address.required=True
db.contact.zip.required=True
db.contact.city.required=True
db.contact.country.required=True
db.contact.phone.required=True
db.contact.email.required=True
db.contact.account.required=True
*
db_wizard_requires.py*
# contact
db.contact.salutation.requires=IS_IN_SET(['Mr.', 'Mrs.', 'Ms.'])
db.contact.first_name.requires=IS_NOT_EMPTY()
db.contact.last_name.requires=IS_NOT_EMPTY()
db.contact.gender.requires=IS_IN_SET(['Male', 'Female'])
db.contact.job_title.requires=IS_NOT_EMPTY()
db.contact.address.requires=IS_NOT_EMPTY()
db.contact.zip.requires=IS_MATCH('^\d{5,5}$',
                                 error_message='not a zip code')
db.contact.city.requires=IS_NOT_EMPTY()
db.contact.country.requires=IS_NOT_EMPTY()
db.contact.phone.requires=IS_NOT_EMPTY()
db.contact.email.requires=[IS_EMAIL(), 
                           IS_NOT_IN_DB(db, 'contact.email')]
db.contact.account.requires=IS_IN_DB(db, db.account.id, '%(account_name)s')

On Friday, April 5, 2013 5:25:55 PM UTC-4, Massimo Di Pierro wrote:
>
> No it is not. Something in the code must be resetting it.
>
> On Thursday, 4 April 2013 22:13:25 UTC-5, 黄祥 wrote:
>>
>> hi,
>>
>> is it normal for list:string type field is empty when on editing page?
>>
>> e.g.
>> db.define_table('contact',
>> *    Field('salutation'),*
>>     Field('first_name'),
>>     Field('last_name'),
>> *    Field('gender', 'list:string'),*
>>     Field('birthday', 'date'),
>>     Field('job_title'),
>>     Field('address', 'text'),
>>     Field('zip'),
>>     Field('city'),
>>     Field('country'),
>>     Field('phone'),
>>     Field('fax'),
>>     Field('email'),
>> *    Field('account', 'reference account'),*
>>     format='%(first_name)s %(last_name)s')
>>
>> *db.contact.salutation.requires=IS_IN_SET(['Mr.', 'Mrs.', 'Ms.'])*
>> db.contact.first_name.requires=IS_NOT_EMPTY()
>> db.contact.last_name.requires=IS_NOT_EMPTY()
>> *db.contact.gender.requires=IS_IN_SET(['Male', 'Female'])*
>> db.contact.job_title.requires=IS_NOT_EMPTY()
>> db.contact.address.requires=IS_NOT_EMPTY()
>> db.contact.zip.requires=IS_MATCH('^\d{5,5}$',
>>                                  error_message='not a zip code')
>> db.contact.city.requires=IS_NOT_EMPTY()
>> db.contact.country.requires=IS_NOT_EMPTY()
>> db.contact.phone.requires=IS_NOT_EMPTY()
>> db.contact.email.requires=[IS_EMAIL(), 
>>                            IS_NOT_IN_DB(db, 'contact.email')]
>> *db.contact.account.requires=IS_IN_DB(db, db.account.id, 
>> '%(account_name)s')*
>>
>> i make 3 different field type (bold) that contain drop down in the form 
>> view. why the value is always empty for the list:string type when i'm on 
>> the editing page? is it possible for not empty for list:string type in 
>> editing page?
>> any idea or explaination about this?
>>
>> thank you so much before
>>
>

-- 

--- 
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