Solved

web forms with multiple tabs

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
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…

929 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

12 Experts available now in Live!

Get 1:1 Help Now