I had a user profile form with many tabs and sub tabs. The client was frustrated that upon saving the form the page refreshed and started on the default tab. In order to keep the tab they were working on open I added some jQuery to the field_group/horizontal-tabs/horizontal-tabs.js file. This is my first patch so please let me know if there is anything more I can do.
Known issues:
The jQuery runs in the view mode and edit mode. This should be fixed since there is no form on the view mode.
This is the jQuery added to the focus function of horizontal-tabs.js:
//append the tab anchor to the action of the form to preserve state
formaction = $('form').attr('action');
var hashind = formaction.indexOf("#");
var newaction = formaction.substring(0,hashind)+"#"+$(this.fieldset).attr('id');
$('form').attr('action',newaction);
Comments
Comment #1
omegared commentedhere is the patch
Comment #2
rolando.alevelbeyond commentedJust tried this out and it works great.. i just added a little more js to make the page scroll to top instead of displaying where the anchor is just so it's easier for the client and doesn't scroll down to the top of the horizontal group.
Comment #3
socialnicheguru commentedComment #5
sokru commentedJust reroll to current dev.
Comment #6
nils.destoop commented