Copy link to clipboard
Copied
Hello,
I have an accordion widget with two panels. On the first panel is a welcome screen and on the second a user registration form. On this form I have server side validation. If the information entered fails the severside validation, the page refreshes, with the first panel open, which contains the welcome screen. Does anyone know how to keep the current open panel after a page refresh, so the user remians on the second accordion panel, which contains the form?
Any help would be fantastic,
Thank you.
The way to link to a specific Spry panel is described in this tutorial on my website: http://foundationphp.com/tutorials/spry_url_utils.php.
The tutorial deals with values pass through the URL, so only the basic principles apply to your scenario. When validating a form server-side, you'll be using the POST method, so you'll need to adapt everything to use conditional logic on the server side like this:
...
var Accordion1 = new Spry.Widget.Accordion("Accordion1", {defaultPanel: <?php if ($errors) { ech
Copy link to clipboard
Copied
The way to link to a specific Spry panel is described in this tutorial on my website: http://foundationphp.com/tutorials/spry_url_utils.php.
The tutorial deals with values pass through the URL, so only the basic principles apply to your scenario. When validating a form server-side, you'll be using the POST method, so you'll need to adapt everything to use conditional logic on the server side like this:
var Accordion1 = new Spry.Widget.Accordion("Accordion1", {defaultPanel: <?php if ($errors) { echo 1; } else { echo 0; } ?>});
Copy link to clipboard
Copied
Hey David,
Thank you once again. As soon as I typed in what you suggested, it worked perfectly. . I only needed to slighty adjust the errors variable for my error array.
Have a good w/end,
Andrew.