Solved

web forms with multiple tabs

Posted on 2004-03-22
3
1,986 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

730 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