Hy!
I have a tab switcher, with four different tabs, two of them are for user and car.
When I click (in my list of users) on selected user, it goes from there to tab swither - to tab user (for editting user). If I select tab car, car of that user comes up, and I can edit car (for editing car). But if I click button Save, it throws me back to tab user (all fields are empty) and if I after that again click on tab car, it says: Saved successfully...
Where is the problem? Thanks!
Tab switcher
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Tab switcher
Vague, but if it says "saved successfully," it's likely been saved successfully. You just have an issue in your code where the default tab is still set to your "user" tab after submitting your form. If your "tab switcher" uses a hash on your URL to define the currently opened tab, then you need to use that in your <form>'s action attribute. So, if to default to the car tab you go to http://example.com/file.php#car, then change your action from "http://example.com/file.php" to "http://example.com/file.php#car".
Re: Tab switcher
I don't know where the default tab is selected/written... I'm using this:
http://homework.nwsnet.de/products/e877_tab-switcher
http://homework.nwsnet.de/products/e877_tab-switcher
Re: Tab switcher
Anyone please?
Re: Tab switcher
In tabswitcher.js, find
and replace it with
This solution could cause all tab pages to disappear if the hash does not match an existing tab id. You might want to test that the requested id matches one of the elements in the aElems array rather than just testing that the hash exists as is done here.
Be sure to follow superdezign's advice of adding the appropriate hash to the form's action attribute.
Code: Select all
// Display the first tab content.
this.show(this.targetIds[0]);Code: Select all
// Get the hash from the URI.
var id = window.location.hash.split('#')[1];
if (id) {
// Display the requested tab content (if it exists).
this.show(id);
} else {
// Display the first tab content.
this.show(this.targetIds[0]);
}Be sure to follow superdezign's advice of adding the appropriate hash to the form's action attribute.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Tab switcher
If McInfo's solution does cause issues, then find out how your tab switchers defines the active tab and submit the form with a query string in the action attribute instead of a hash. Then, use that to dynamically generate JavaScript code to define the active element.