I'm trying to figure out how to get field name when using FORM in the
controller.  I can draw the form input fields or put a label on it,
but can't seem to figure out how to just call the form field name as a
variable in the view.  Ideally I'd like to be able to do something
like this in the view:

{{ for field in form: }}
   <li> <label>{{=field.name}}</label> {{=field}} </li>
{{pass}}

This is my controller:

def roomcreate():
    form = FORM(
                   INPUT(_name='room_name', requires=IS_NOT_EMPTY()),
                   INPUT(_name='attendee_pw',
requires=IS_NOT_EMPTY()),
                   INPUT(_name='moderator_pw',
requires=IS_NOT_EMPTY()),
                   INPUT(_name='welcome_msg',
requires=IS_NOT_EMPTY()),
                   INPUT(_type='submit')

I've tried wrapping the the INPUT inside of a "LABEL" tag but that
doesn't give me the end result HTML I need.  I really need to be able
to call the field itself and field name as separate variables in the
view.  I know worst case I can manually create the HTML for the whole
form but I'm trying to learn and figure out if this is possible first
before I do that.

Thanks for any help or pointers.

-Keith

Reply via email to