lol, well I've been all around that. Thank you so much, works just fine now.
Is there a quick 2-min "why that works" or somewhere you could point me to as to what that * means/does? Apparently I'm missing out on something important. On Oct 29, 10:33 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > form=SQLFORM.factory(*[fields[num] for num in range(len(fields))]) > > On Oct 29, 10:25 am, Chris S <sanders.ch...@gmail.com> wrote: > > > I've been trying to get a form built where the number of Fields are > > dynamic. I was successful with the plan form by using: > > ------------Form Implementation------------------------ > > fields=[] > > for item in list: > > fields.append(item) > > fields.append(INPUT(_name=item,requires=IS_INT_IN_RANGE > > (0,100,error_message=('Must be an Int 0 to 100')))) > > fields.append(INPUT(_type='submit')) > > > form=FORM([fields[num] for num in range(len(fields))]) > > ------------Form Implementation------------------------ > > > I can append items to my form but the output in HTML is nasty. > > Everything is just crammed together. I read about form.custom and was > > going to use that approach but apparently I have to use the > > SQLFORM.factory() to use that. Attempting the same thing in > > SQLFORM.factory() looks like > > > ------------SQLFORM.factory() Implementation------------------------ > > fields.append(Field('item1')) > > fields.append(Field('item2')) > > > form=SQLFORM.factory(fields[0]) > > #This works, but obviously isn't dynamic I only get the first entry. > > > form=SQLFORM.factory(fields[num] for num in range(len(fields))) > > #This errors with "define_table argument is not a Field: <generator > > object at 0x110BD7B0>" > > ------------SQLFORM.factory() Implementation------------------------ > > > Can anyone help me out here? I want to be able to arrange the fields > > in HTML like I want (which I can't seem to do with just the simple > > form), but I also want to be able to build the fields dynamically > > which I can't seem to get working with SQLFORM.factory(). I'm sure > > I'm missing something easy, this can't be as hard as I'm making it. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---