Bug #32303
Lifetime of a form
| Status: | Resolved | Start date: | 2011-12-05 | |
|---|---|---|---|---|
| Priority: | Must have | Due date: | ||
| Assignee: | Reinhard Führicht | % Done: | 100% |
|
| Category: | Code and Architecture | |||
| Target version: | v1.5.0 | |||
| Votes: | 1 (View) |
Description
I found a crazy behaviour of the formhandler. I created a form, which works very well, when you fill out the fields immediatly and submit the form.
But when i request a page with a form, leave it alone (to get another cup of coffee), fill out the form sometimes later and submit it. it wont sumbit correctly. i only get the filled out form again and again.
is there any form lifetime due to security reasons?
Associated revisions
Do not remove session of the current form (resolves #32303)
Do not remove session of the current form (resolves #32303)
History
Updated by Reinhard Führicht over 1 year ago
- Category set to Code and Architecture
- Status changed from New to Accepted
- Assignee set to Reinhard Führicht
- Target version set to v1.1
Yes, that's strange, indeed.
Maybe it is just the PHP session timeout.
I will try to reproduce this in the next days.
Updated by Sven Wappler over 1 year ago
Perhaps it would be possible to show a global timeout error message with a restart-button?
Updated by Reinhard Führicht over 1 year ago
- Target version changed from v1.1 to v1.2
Updated by Reinhard Führicht over 1 year ago
- Target version changed from v1.2 to v1.3
Updated by Reinhard Führicht about 1 year ago
- Status changed from Accepted to Needs Feedback
Hi Tim,
I found out, that Formhandler clears sessions older than 1 hour!
This is cuased by the default value of a TS setting I forgot to doument. I even forgot I added it. :-)
Could this be the reason for the behaviour you described?
The setting is:
session {
class = Session_PHP
config {
clearOldSession {
value = 1
unit = hours
}
}
}
In the next TER release it will be renamed to:
session {
class = Session_PHP
config {
clearSessionsOlderThan {
value = 1
unit = hours
}
}
}
Updated by Alexander Pankow about 1 year ago
I think Tim means, that it is no timeout-message will be shown. In my opinion, it is better to show a message after submitting, that the form has timed out and the user have to fill out the form again.
Updated by Reinhard Führicht about 1 year ago
I will see what I can do. It should be possible to find out if a session timed out. But what I asked Tim was, if the session timeout set in TS (or the default setting) could be the reason for what he described. Maybe it is a bug in a specific browser and has nothing to do with that?
Updated by Nathan about 1 year ago
I have been looking into this because it is also causing a lot of problems with some of my sites. I first tried modifying the session time in TS as you have above, then when that didn't work, I modified it in the actual class. That did not work either.
I did some more research and found that on Debian Linux systems, the PHP session time is not controlled by any setting in PHP itself but rather a cron job that removes the session data according to the time you set in php.ini. So changing the session time in PHP script in this case has no effect. See http://stackoverflow.com/questions/3865303/debian-based-systems-session-killed-at-30-minutes-in-special-cron-how-to-overri
I understand why formhandler needs the session info - mainly to store multiple page post values as well as the unique id for each form. However, this creates a problem in certain cases. Say I have a form that only needs one page. For example, a small simple "contact" form. A user loads the contact page and starts filling in the form. Then they decide to open another tab on the browser and go look at some other things. Later, they come back to the tab that has your contact page. They decide to fill out the form. Well, the form will not submit because the session for that tab has timed out. This is odd behavior because the user didn't do anything "wrong" (their data is still sitting in the form) but the form won't submit. The session timeout would make sense for something like a job application or something with multiple steps and maybe a login or whatever, but it makes no sense for a simple contact form.
Other T3 form extensions do not use the session so they don't have this problem. However, without sessions, you cannot have multiple page forms (without javascript at least). So there really is no solution to this that I can think of, except maybe make formhandler not use the session for single page forms? That would be a lot of work though. Another solution is to use ajax submit for single page forms but that is also a lot of work and not easy for everything (file uploads for example).
Updated by Reinhard Führicht 12 months ago
- Status changed from Needs Feedback to Accepted
- Target version changed from v1.3 to v1.4
Thank you very much for digging into this, Nathan!
You are right, it is not easy to get rid of using the session, because Formhandler relies on the session data a lot.
I will see if it is at least possible to display some message that the session timed out.
Updated by Reinhard Führicht 9 months ago
- Target version changed from v1.4 to v1.5.0
Updated by Reinhard Führicht 6 months ago
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
Applied in changeset r67838.