Loading ...
Sorry, an error occurred while loading the content.

20232Re: TabView activeTabChange event

Expand Messages
  • wmlpez
    Oct 31, 2007
    • 0 Attachment
      Any takers to set me straight? :-)

      To recap, I'm trying to maintain which tab was selected during each
      postback (.Net web app). I'm trying to catch the activeTabChange event.

      Here's the js in the page header area. For the <body> onload event I
      have it set to call the setTabIndex function but it get a js null
      error that I cannot pin point.

      <script type="text/javascript">
      var mTabs = new YAHOO.widget.TabView("models");
      var handleActiveTabChange = function(e) {
      var hdnFieldIdx = document.getElementById("hdnSelectedTab");
      hdnFieldIdx.value = e.newValue;};
      mTabs.addListener('activeTabChange', handleActiveTabChange);
      }
      function setTabIndex(){
      var selectedIndex = document.getElementById("hdnSelectedTab").value;
      alert('selectedIndex: ' + selectedIndex);
      var tabView = document.getElementById("models");
      if (typeof selectedIndex!=="undefined" && (! isNaN(selectedIndex)) ){
      tabView.set('activeIndex', selectedIndex);
      }
      else{
      tabView.set('activeIndex',0);}
      }
      </script>

      --- In ydn-javascript@yahoogroups.com, "wmlpez" <wmlpez@...> wrote:
      >
      > --- In ydn-javascript@yahoogroups.com, "wmlpez" <wmlpez@> wrote:
      > >
      > > Hello. Sorry for the newbie js question. I'm using the
      > > tabview in a .net 1.1 web app (maintenence app not my
      > > doing). The issue I have is after a postback is
      > > complete the page resets the activeTabIndex. How do I restore the tab
      > > to the selected tab before the postback( using the activeTabChange
      > > event)? I'm not sure how to wire the event. I was thinking that during
      > > the firing of the activeTabChange event I would set a hidden field
      > > with the tab index then during the page load read the hidden field
      > > then set focus to the proper tag. I'm open to any suggestions to
      > > accomplish this in the most elegant manner (code snippets most
      > > appreciated :-).
      > >
      > > Thanks,
      > > -Will
      > >
      >
      > I have an half baked solution...still working out the kinks.
      >
    • Show all 6 messages in this topic