[web2py] Re: How do I track who clicks a submit button?
Depends on your goals. If we're talking about a SQLFORM based on a db table, it might make more sense to have a created_by and/or modified_by field in the table. The field(s) could be set to readable=writable=False, and set the default to auth.user_id. Whenever a record is inserted or updated, you then have the id of the user. In any case, the current logged in user's id is in auth.user_id (which is None if the user isn't logged in), so you could store that wherever you like upon form submission. Anthony On Friday, March 7, 2014 5:01:03 PM UTC-5, Austin Taylor wrote: I'm trying to figure out a way to track users who click the submit button. Maybe using their db.auth_user.username and appending it to a list whenever they click submit? I literally just have no idea where to start and any advice would be appreciated. Best, Austin -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: How do I track who clicks a submit button?
Thank you so much, Anthony. What if I have multiple users logged in? How would I store their ID upon clicking? Sorry I'm still learning I know that is a noob question. On Fri, Mar 7, 2014 at 5:54 PM, Anthony abasta...@gmail.com wrote: Depends on your goals. If we're talking about a SQLFORM based on a db table, it might make more sense to have a created_by and/or modified_by field in the table. The field(s) could be set to readable=writable=False, and set the default to auth.user_id. Whenever a record is inserted or updated, you then have the id of the user. In any case, the current logged in user's id is in auth.user_id (which is None if the user isn't logged in), so you could store that wherever you like upon form submission. Anthony On Friday, March 7, 2014 5:01:03 PM UTC-5, Austin Taylor wrote: I'm trying to figure out a way to track users who click the submit button. Maybe using their db.auth_user.username and appending it to a list whenever they click submit? I literally just have no idea where to start and any advice would be appreciated. Best, Austin -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/JQayRnZibYA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: How do I track who clicks a submit button?
What does the submit button do? On Friday, March 7, 2014 6:20:46 PM UTC-5, Austin Taylor wrote: Thank you so much, Anthony. What if I have multiple users logged in? How would I store their ID upon clicking? Sorry I'm still learning I know that is a noob question. On Fri, Mar 7, 2014 at 5:54 PM, Anthony abas...@gmail.com javascript: wrote: Depends on your goals. If we're talking about a SQLFORM based on a db table, it might make more sense to have a created_by and/or modified_by field in the table. The field(s) could be set to readable=writable=False, and set the default to auth.user_id. Whenever a record is inserted or updated, you then have the id of the user. In any case, the current logged in user's id is in auth.user_id (which is None if the user isn't logged in), so you could store that wherever you like upon form submission. Anthony On Friday, March 7, 2014 5:01:03 PM UTC-5, Austin Taylor wrote: I'm trying to figure out a way to track users who click the submit button. Maybe using their db.auth_user.username and appending it to a list whenever they click submit? I literally just have no idea where to start and any advice would be appreciated. Best, Austin -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/JQayRnZibYA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: How do I track who clicks a submit button?
Each request is separate and independent. When a given user submits a form, a request is generated for that submit. In that request, the value of auth.user_id is the id of that particular user. When a different user submits the form, that generates an entirely new request, and in that request, the value of auth.user_id is the id of the second user (even if both submissions happen nearly simultaneously). Anthony -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.