Getting empty form fields with Python cgi stdlib

后端 未结 3 1079
遇见更好的自我
遇见更好的自我 2021-01-26 05:44

I am passing multiple form fields which are optional, but which need to be associated with a user. Python\'s cgi.FormDict and cgi.FieldStorage both eliminate blank entries, so i

3条回答
  •  攒了一身酷
    2021-01-26 06:12

    I'm not sure if you can tweak cgi.FromDict to do what you want, but maybe a solution would be to make every input set uniqe like so:

    
    
    
    
    
    

    Note thate MailingList1 and Mailinglist2 now hafe a suffix for the "entry block".

    You will have to add this at generation time of you Form and then adapt your processing accordingly by reading the checkboxes like so:

    lv_key = 'MailingList1_' + str(i)
    MailingList1 = myFormDict[lv_key]
    ...
    

    Regards,

    Martin

提交回复
热议问题