Forums

URLs and multipage forms

doulfe 04 Feb, 2015
Hi,

I created a multipage form - each page has its own submit button called Next that leads to the following page. After I press the Next button on the first page, the URL changes to something like "/index.php?option=com_chronoforms5&chronoform=application1&event=Page+Two".

If I access this URL directly, without starting the form from the beginning, the second page loads fine and I can carry on with the form. But at the end I will submit the form without all the required fields on the first page. Is there any way I can check if all the fields from the previous pages have been correctly filled in? In case someone decides to access pages 2, 3... of the form via direct URL?

Many thanks.
GreyHead 05 Feb, 2015
Answer
Hi doulfe,

On the first page add some kind of identifier to the form. Say a hidden input with name=page and value=page_1

In the ON Load event for page 2 use an event switcher to check the value of this input; if it is empty then redirect the user back to Page 1.

You can extend this idea by changing the value on each page to track the user through.

A more sophisticated version would be to save the data to a db table after each page and check the saved record on each page load.

Bob
doulfe 05 Feb, 2015


On the first page add some kind of identifier to the form. Say a hidden input with name=page and value=page_1

In the ON Load event for page 2 use an event switcher to check the value of this input; if it is empty then redirect the user back to Page 1.



Thank you very much, this worked!
doulfe 25 Feb, 2015
Hi again,

Even though it all works fine when I try the form and it won't let me submit without having all required fields filled in, I sometimes receive incomplete submissions from other users. These users claim to have filled in all the required fields, but in the database I only see the fields from the 4th page, or the fields from the 3rd and 4th pages - the other fields being empty. This happens for approximately one submission in ten. Is there anything I could do for some extra checking?
The form is here (4 pages in total) http://www.placementslovakia.com/how-to-apply/application-form

Many thanks
GreyHead 27 Feb, 2015
HI Doulfe,

Add serverside validation to check that the data is complete.

Bob
doulfe 06 Mar, 2015
Hi GreyHead

I added serverside validation, disabled JS validation (so I could test it). Of course, on fail it loads the first page of the form - as it should. I fill in the form again with the correct information, but on submit it returns the same errors and redirects to the first page again. Am I doing something wrong?

Thanks
This topic is locked and no more replies can be posted.