View Full Version : Form Submission and Spry Tabbed Panels
ChrisW
01-27-2012, 07:47 AM
I have a contact form that is inside a spry tabbed panel. I have learned a lot about spry tabbed panels in the past few days but I seem to be having trouble with setting the javascript so that the spry does not default to the default tab onclick or refresh.
Does anyone know where there is easy to read literature so I can learn this? Any help would be very much appreciated - Thanks
http://216.172.187.90/~dinky/tattoo-artist-greg.php
Jason Byrnes
01-27-2012, 10:45 AM
When using tabbed panels, the code that initializes the tabbed panel will look like this:
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
[code]
the tabs are indexed numerically starting at 0.
you can specify the fault tab by using the defaultTab setting:
[code]
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab:1});
sets the second tab as the default. your form is on tab 4 (index 3). you could add a qurystring variable to the forms action:
<form class="gregg_csstemplate" id="contactinfo_gregg_csstemplate" name="contactinfo_gregg_csstemplate" method="post" action="/~dinky/tattoo-artist-greg.php?form=true">
then use a php if statement to dynamically set the default tab to the form tab when it is submited:
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"<?php if(isset($_GET['form']) && $_GET['form'] == "true") {?> , {defaultTab:3}<?php } ?>);
Not much can be done on refresh. refresh is just loading the page, so theres nothing unique to test for.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.