473,396 Members | 1,827 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,396 software developers and data experts.

Return to original page and tab after submitting form

I have a page with 4 tabs, with is set to open on a default tab when loaded [Tab2].

After submitting from a simple form on this page [Tab1], it goes to the updatediary.asp page, does the updates, then redirects to the original page with a "Response.Redirect".

This is normal behaviour, but the Response.Redirect opens the page on the default tab [Tab2], and I want it to open on the tab containing the form [Tab1].

Is there any way to do this?

This is the code for the tabs :

<div class="tab"> <button class="tablinks" onclick="openTab(event, 'Enter a Visit')" id="Tab1">Tab1</button> <button class="tablinks" onclick="openTab(event, 'Medical Conditions')" id="Tab2">Tab2</button> <button class="tablinks" onclick="openTab(event, 'Treatment History')" id="Tab3">Tab3</button> <button class="tablinks" onclick="openTab(event, 'Current Pupils')" id="Tab4">Tab4</button> </div>

... and this is the function which controls the tabs :

<script>

function openTab(evt, TabName) {
// Declare all variables
var i, tabcontent, tablinks;

// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}

// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}

// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(TabName).style.display = "block";
evt.currentTarget.className += " active";
}
// Get the element with id="Tab2" (default) and click on it
// MAKE IT OPEN TAB2
document.getElementById("Tab2").click();

</script>

Many thanks in advance!
Mar 16 '18 #1
0 4183

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

Similar topics

1
by: Newbie | last post by:
OK, this may be impossible since I'm using 3rd party shopping cart ASP software, but I've been able to finagle a lot of other stuff I thought wouldn't work, so here we go: I'm using a form in...
4
by: Kai Grossjohann | last post by:
I have two frames. Frame "search" contains a search form specifying an onsubmit action like so: <form ... onsubmit="foo();"> ... </form> The other frame contains a <img ......
2
by: Asha | last post by:
Greetings, I need to redirect my user back to where they came from, but I cant use history.back cause for some particular reason. What is the function in asp.net to allow me to archive this?
8
by: Edward Mitchell | last post by:
I have a main project that is protected in that the user is directed to a login.aspx file. The text in the web.config file is: <authentication mode="Forms"> <forms loginUrl="Login.aspx" />...
5
by: Chris | last post by:
Hello, I have a link on an aspx page. The URL is set in the Page Load event: lnkEventHistory.NavigateUrl = "javascript:window.open('EventHistory.aspx?TeenID=" & _ Request.Item("SubjectID") &...
1
by: Lyners | last post by:
I am trying to figure out how to do this. I have created a form on a webpage that shows users that you can edit or delete. I have a hyperlink to another webpage that adds users. The "Add Users"...
5
by: monomaniac21 | last post by:
Hi all Can anyone tell me how to submit a form to update its contents to a db and then from the page the form is submitted to then submit another form which is the payment processing data for a...
4
by: roxanaislam | last post by:
Submitting Form by pressing the "ENTER" key -------------------------------------------------------------------------------- Hi: I have a search form in my application which has 4 dropdown...
1
by: GD | last post by:
I need a script to open a popup window which contains a php form. after the form has been submitted or cancelled i need to go back to the originated page (php also) and reload original page. do...
26
by: pepper.gabriela | last post by:
Hello, a stupid question but... page_A.php is a page with a form. The user inserts text in four fields, then he clicks a submit button. The data goes to page_B.php: this page controls the data...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.