Handling Multiple WFFM Forms on single page w/Dynamic tabs
We have a page with three Web Forms For Marketers forms that are on three separate DHTML tabs. If a user fills out and submits the form, they end up back on the default tab, and their thank message is on the tab of the form they filled开发者_如何学Go out.
We looked into possibly using hastags to indicate which tab you are on so we can set the proper focus when the page loads after the WFFM Form postsback, but hashtags are stripped off the URL during the postback. Query string parameters do seem to survive the postback, but having the tab navigation set these would incur a post back themselves, eliminating the advantage of using DHTML tabs.
Does anyone have a good solution for handling displaying the correct tab after the postback?
Sitecore Version: 6.4.1 (rev. 110324) Web Forms for Marketers-2.2.0 (rev. 110303)
For an alternative method, you could use javascript to update a cookie eat time the tab is changed. When the page is next loaded, the cookie is checked to find out what the last tab the user was on and restores that tab as the default one (it could also clear the cookie at this point).
You could use a cookie for this.
- When a tab is selected, store off the cookie (under a unique name if necessary, for the current path, etc) with a value of the selected index.
- On page ready, check for your cookie. If present, grab the value, and set the appropriate tab as selected.
Yeah, it's a cookie, and probably not 100% ideal, but I think it's fine in this case since this is just UI sugar.
Heck, jQuery UI tabs even has this built in: http://jqueryui.com/demos/tabs/#option-cookie
Override the behaviour of the control that is submitting the form, and in that postback have it emit some javascript to the page that sets the value of the current tab on display. You can just use your javascript on the page to use the variable to set the default tab to display.
精彩评论