Results 1 to 5 of 5

Thread: Strange issue with form generator form

  1. #1
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Strange issue with form generator form

    I have a contact form that I created in the form generator.

    For some reason after submitting a message through the form the POST data seems to 'persist'.

    For example, i'll submit the form and see the redirect page. From that point on every time I click on a new page the data from my contact form is re-posted, or at least the POST values are set. For some reason Contao is remembering the POST data and setting it on every request.

    I know this because I have a custom form on another page, when I visited this page it automatically submitted because it was looking for '$this->Input->post('FORM_SUBMIT')', which was present but should not have been. I am also able to view all the other data posted from my contact form on any page by doing this:

    Code:
    echo $this->Input->post('name'); 
    echo $this->Input->post('email');
    This has even persisted over night, I was testing the contact form yesterday and it was only when I loaded up the site this morning I realised this was happening. How is Contao even 'remembering' the POST data, and where is is being set?!

    Any ideas what is going on here?! I'm using Contao 3.0.6.

    Thanks

  2. #2
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Re: Strange issue with form generator form

    Ok, I've had a look at the Input class.

    It seems Contao stores the form data in a session variable called $_SESSION['FORM_DATA'].

    Every time $this->Input->post('key') is used it fetches the data from this session variable. This means the POST data is available on every request after the data was posted.

    I'm not sure why it does this but I'm sure there is a reason, had me confused though.

  3. #3
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Strange issue with form generator form

    I tried to reproduce with the online demo; Have a form redirect (after submission) to another page that contains the exact same form. I do not see the input values on the second page.

    If that generates the error for you, then you may want to run Contao in safe mode/disable all extensions because the Contao core doesn't have this problem, so it seems.

  4. #4
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Re: Strange issue with form generator form

    hmmm, I'm not sure why it's doing it on the site in question then. I've never seen the problem before but then this is my first Contao 3 site so I wasn't sure if it was supposed to do it or not.

    I've gotten around the problem this time anyway, I'll investigate it further if it comes up again on another site.

  5. #5
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Strange issue with form generator form

    How did you get around? Although probably not a problem with Contao others might have the same problem in the future.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •