473,379 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

how to remain an a tab when button is clicked

123 100+
i have a CSS tab which is tab1 and tab2 and both are on the html page, in both tabs i have a submit button (<input type="submit" name="submit1"/>) on both. if i am in tab2 and i click submit i want it to remain in tab2 not to go back to tab1
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  <head>
  3. <title></title>
  4.  <link href="SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
  5.  
  6. <script type="text/javascript" charset="utf-8"> 
  7. function show(div){
  8. document.getElementById(div).style.display='';
  9. }
  10.  
  11. </script>
  12. </head>
  13. <body>
  14.  <?php
  15.  if (isset($_GET['page'])) {
  16.  $pages = ($_GET['page']);
  17.  } else {
  18.  echo "page one";
  19.  }
  20.  ?>
  21.  
  22.  <ul class="TabbedPanelsTabGroup">
  23.  <li class="TabbedPanelsTab" tabindex="0"  id="one" >Tab1</li>
  24.  <li class="TabbedPanelsTab" tabindex="0"  id="two" >Tab2</li>
  25.  </ul>
  26.  
  27.  <div class="TabbedPanelsContent">
  28.  <div>
  29. <form action="home.html" method="post">
  30.   <input type="submit" name="submit1"  value="Submit"   onclick="show('one')"/>
  31. </form>
  32.  </div></div>
  33.  
  34.  <div class="TabbedPanelsContent">
  35.  <div>
  36. <form action="home.html" method="post">
  37.   <input type="submit" name="submit1"  value="Submit"   onclick="show('two')"/>
  38. </form>
  39.  
  40.  </div></div>
  41.  
  42.  </body>
  43.  </html>
  44.  
Aug 23 '10 #1
7 3734
gits
5,390 Expert Mod 4TB
then you could either use AJAX-calls to avoid the page-reload or add a flag serverside to the page (could be a javascript-variable like: var startTab = 'tab2') and process it in the page's onload event.
Aug 24 '10 #2
omerbutt
638 512MB
or you can do the same but submit the values on a separate page and then return back to this page with a query string which could be checked to make any of those tab selected
lets say form is submitted on the page2.php after doing your operations
header('location:orignal-page.php?tab=1');

and on the orignal-page.php check
if(isset($_GET['tab']) && $_GET['tab']==1){
//make your tab selected by either applying the css class or what ever you desire
}


regards,
Omer Aslam
Aug 24 '10 #3
simon2x1
123 100+
i want it on the same page(home.php) but the tab2 which i am on and i click on submit inside tab2 on the samepage(home.php) don't forget should display the tab2 i am on and not to take me but to tab1
Aug 24 '10 #4
omerbutt
638 512MB
if you mean to say that you donot want to submit it on another page then it would be better to use AJAX other wise if the requirement is that after submitting the information you want to be back on the same tab then i have told you the solution it would work in the same way
Aug 25 '10 #5
simon2x1
123 100+
i am a newbie when it come to Ajax but if you say it is going to work the same way i need you to edit my code and let me see it
Aug 30 '10 #6
simon2x1
123 100+
This is what am trying to say, the tabs are on the same page not different pages am talking about the content of the tabs i want the content of tab2 to display when ever i click submit button(onclick)in the content of tab2 not to take me back to tab1.
Oct 15 '10 #7
simon2x1
123 100+
please am still waiting for my reply
Oct 23 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: TJS | last post by:
trying to get 2 scripts to run when a button is clicked. The first is a confirm which should only run the second script if true. the problem is the second script doesn't run when "ok" is selected...
0
by: L Mehl | last post by:
Hello -- My form's cmdCancel button requires 3 clicks before the code in Cancel_Click fires. Each click prior to that success moves the highlight to the next field in the Tab order . I...
2
by: Patrick | last post by:
i have the following .aspx file defined: ..... other tags here ... <asp:TableCell><asp:button id="AddButton" Runat="server" Text="Add New Vessel..."</asp:button></asp:TableCell> ..... other tags...
0
by: ABC | last post by:
How to make change one frame size (width) when I clicked a button on anothoer frame?
1
by: thewickedman | last post by:
Hi, I try to open new OpenOffice document (writer), But I am getting the exception FRM 40735:WHEN-BUTTON-PRESSED Trigger Raised unhandled Exception ORA - 305500 Please help me to resolve...
2
by: jayasabari | last post by:
Hai, When button is clicked, then i have to prevent the execution of one function in page load. can you give any suggestion please. With Regards, K.Jayasabari
1
by: CHNLAKSHMI | last post by:
There are two textboxes and a button. If we click the button,the text must be entered into focused textbox
3
matrekz42
by: matrekz42 | last post by:
This may seem extremely simple, but I want to have in VB a code that will change the width of a TextBox when a button in the form is clicked. How can I go about this?
5
by: Jim in Arizona | last post by:
When placing a link using html, it's easy to have a new window opened for the link instead of redirecting the current page to the destination. IE: <a href="../folder5/anotherpage.aspx"...
9
by: ghjk | last post by:
change the background image when Button Click ====================================== I' developing site with php and postgres. It has menus list in the left side. and all are images(jpg) EX:Add...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.