Hello,

I am trying to cook up something with a list or tuples of images, but it 
does not and cannot show up in the view within a form ...

( let me show some codes )

a basic model file


user_sex = [SPAN(IMG(_src=(URL('static','images/male_thumb.png')))),SPAN(IMG
(_src=(URL('static','images/female_thumb.png'))))]

db.define_table('test_user',
    Field('my_name', type='string',
          label=T('First Name')),
    Field('sex',requires=IS_IN_SET(user_sex),label=T('My Sex is'))) 

from plugin_hradio_widget import hradio_widget

db.test_user.sex.widget = hradio_widget 

As you see ...in the same model file, I have defined  the user_sex 
I have also used the hradio widget to have radio buttons instead of a 
dropdown select list ...

Just for testing purposes ... 
in the controller ... I have
def testpage():
    form = SQLFORM(db.test_user)
    if form.accepts(request.vars, session):
        session.flash = 'submitted %s' % form.vars
        redirect(URL('index'))
    return dict(form=form)

in the view testpage.html, I simply put in the usual expected {{=form}}

I did not get the images to select ... instead ... I get 2 strings as 
written in the user_sex but no images !!??? ..

Can someone explain to me ... why do I think this should of worked ... and 
if this can be done ... how ? .. 

tell me what am i doing wrong ? ...

How can I provide a user a list of images to select from on a form ??? ... 
I am very annoyed by this !! ...

Please advise me  or show me what I have done wrong ? ... 


thank you

Don



-- 



Reply via email to