Solved

web forms with multiple tabs

Posted on 2004-03-22
3
1,981 Views
Last Modified: 2007-12-19
I'm having problems implementing web forms with multiple tabs. I want to store a range of input data from these multiple tabs into a database.

I use a DIV for each TAB and javascript functions to enable and disable the tabs.
1st problem: When the page is first loaded I call the showPanel(1) to make the first tab visible and others 'hidden'. Although I set other tabs as 'hidden', I still can go to other tabs before completing the form on the first tab. How do I make it totally disable?

2nd problem: I call showpanel(1) when the page is loaded. e.g. <body onLoad="showPanel(1)">. So, everytime I refine the listbox on other tabs (e.g. tab 2, 3) and the page is refreshed, it always go back to the first tab. How do I refresh the page is make it stay on the same tab?

I use javascript, html and pl/sql
 <-- Java script -->
function showPanel(panelNum){
     //hide visible panel, show selected panel, set tab
           if (currentPanel != null) {
          hidePanel();
     }
         document.getElementById("panel"+panelNum).style.visibility = "visible";
        currentPanel = panelNum;
        setState(panelNum);
     }

     function hidePanel(){
        //hide visible panel, unhilite tab
        document.getElementById("panel"+currentPanel).style.visibility = "hidden";
        document.getElementById("tab"+currentPanel).style.backgroundColor = "#ffffff";
        Document.getElementById("tab"+currentPanel).style.color = "navy";
     }

     function setState(tabNum){
          if(tabNum==currentPanel){
               document.getElementById("tab"+tabNum).style.backgroundColor = "#ddddff";
               document.getElementById("tab"+tabNum).style.color = "red";
          }else{
               document.getElementById("tab"+tabNum).style.backgroundColor = "#ffffff";
               document.getElementById("tab"+tabNum).style.color = "navy";
          }
     }
 
many thanks,
0
Comment
Question by:denz_1
3 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 125 total points
ID: 10648561
A#1: your showpanel(2) needs a state var to allow or disalow swaping the tabs.
A#2: for onLoad you need a showpanel() version WITHOUT tab number to lookup last stored tab number from cookie or from a hidden field.

Show your page for more details.

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now