If you have two forms, use two classes to process them. Your source code for user registration and authentication should be as simple and straight forward as possible, to reduce the probability of something going very wrong. If you try to handle two forms in one class, you will have to check a lot of conditions, as you already tried, and it will be ugly.
If you insist on using one class, use different field IDs for each one, such as username_register Vs username_login. But again, bad idea. -- Marios Zindilis On Tue, Oct 27, 2015 at 1:39 AM, Jonathan Saewitz <[email protected]> wrote: > I give users the option to register and log in on the same page — these > require two forms. I'm having trouble differentiating between which form > the user submitted. I considered checking if the 'username' portion of > either form was blank, and if it was blank, I would know the other form was > the one submitted. However, if a user started filling out the registration > form and then used the log in form, this wouldn't work because neither > username textbox would be blank in either form. What's the best way to go > about telling which form a user submitted when there are two forms on one > page? > > By the way, someone had the same issue as me over four years ago > <https://groups.google.com/forum/#!searchin/webpy/two$20forms/webpy/A2VfpG2FwiY/Dfs7jxMhmCEJ>, > but I couldn't figure out how to do the suggestions. > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/webpy. > For more options, visit https://groups.google.com/d/optout. > -- Marios Zindilis -- You received this message because you are subscribed to the Google Groups "web.py" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/webpy. For more options, visit https://groups.google.com/d/optout.
