Hello Richard!

I looked at this, but wasn't sure how it could help -- what I need is a way 
for a (non-technical) admin to create profile forms with arbitrary fields 
(through a friendly web interface), and then users to be able to view and 
edit their (run-time reconfigurable) profiles.

At any rate, the method I described above seems to work quite well,  thanks 
to web2py's versatility, allowing me to define forms programmatically 
(excerpt below).

I was wondering if there was a more clever/efficient/proper way to do so. 
Perhaps not!

Thanks!!
Luis.

    for field in event_fields:
          # see if person has a pre-defined value
          found = False
          for my_efield in me.event_field:
              if my_efield.display_title == field.display_title:
                  found = True
                  break
  
          if found:
              if field.data_type == 'string':
                  new_input = INPUT(_type = field.data_type, _name = 
field.id, requires=IS_NOT_EMPTY(), _value=my_efield.data )
                  form[0].insert(-2, TR(field.display_title+':', new_input 
))
  
              elif  field.data_type == 'text':
                    .....
          else:
              if field.data_type == 'string':
                  new_input = INPUT(_type = field.data_type, _name = 
field.id, requires=IS_NOT_EMPTY())
                  form[0].insert(-2, TR(field.display_title+':', new_input 
))
  
              elif field.data_type == 'text':
                   ....


Reply via email to