On Tuesday, January 20, 2015 at 2:28:04 PM UTC-8, E. Wilson wrote: > > I'm new to web2py and have been doing tutorials to set up simple apps. I > want to create a blog using web2py with an option where readers can > subscribe to my newsletter using their email address. I have yet to find > tutorial where I can learn how to do this. Can someone point me in the > right direction or provide some basic instructions to get me started? Is > there a tool that I should be using? >
You want to collect the email address as data to add to your records. I suggest you use one of the FORM tools, either FORM() itself or SQLFORM() or SQLFORM.factory(). Which one of those do you want? That depends on how you keep your records. I'll assume that you'll keep a subscribers list in a table in your database. This could be as simple as 2 fields (id and a string), or you could have other fields for additional information. If your table and the way you want users to enter data are an exact match, then SQLFORM() may be the easiest. If you want to do some processing of the entry, then FORM or SQLFORM.factory() may be easier. The IS_EMAIL() validator should help avoid poisonous entries. You might find that the existing AUTH facilities already provide everything you need; registering a user and recording a subscriber's address are pretty similar tasks. I have to admit, I'm still pretty much a newbie, but I've done some simple things with forms, and I think you'll find this sort of task simple when you get into it. /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

