Jump to content

Remembering Position on Previous Page


blackcell

Recommended Posts

I need a user to be able to click on a row on page1.php that goes to page2.php. When the user clicks back on page2.php I need them to jump back to page1.php at the same location they left from. I know this has to do with <a name='#name'></a> but I think it will require javascript to be able to span this across two pages.

 

Matter of fact I can get it to pass the value but I don't know how to incorporate the <a name='#name'></a> to load on the return without clicking on something.

 

Edit was: without clicking on something.

Link to comment
Share on other sites

Well, on page 2, you can use something like this:

<a href="javascript:history.go(-1)">GO BACK</a>

then, it will be like clicking the back button, which should jump to the part of the page they were at

 

other then that, the only thing i can thing of giving each row a <a name="#row1"> tag (increment the number after after 1) and then supplying that in the URL when they "go back". Does that makes sense?

Link to comment
Share on other sites

What I am doing now is rolling out 4000+ records into display. On each row is a record and I assign <a name='$recid'></a> in first cell where $recid is the unique database record ID. When they click the row it will pass the record ID to view additional information pertaining to that record (page2.php). What I want is for the user to be able to look at the record and then hit the back button and returning them to the point they left off so they don't have to start at the top of 4000+ records. Will this work that way?

<a href="javascript:history.go(-1)">GO BACK</a>

 

Edit:

Also, they user will be editing on page2.php therefore hitting the submit button multiple times. Will this throw the js piece off?

Link to comment
Share on other sites

If they are doing things on that page, the javascript back won't work. But what you can do is provide a button or link to return to the list:

<a href="page1.php#<?php echo $recid; ?>">Return to list</a>

where $recid would be the current unique ID they are working with.

 

After working out this non-javascript method, you may want to look into some AJAX. So when a user clicks the record, it brings up a Lightbox or Modal Dialog with the records info. Then, allow them to edit and submit changes all with AJAX. Here is one example:

http://extjs.com/deploy/dev/examples/form/form-grid.html

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.