Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Choosing where to start displaying a page

Posted on 2003-10-27
8
Medium Priority
?
167 Views
Last Modified: 2010-04-09
Hi
I want to put a mark in my html to tell the browser to set focus on that mark or to start displaying from that mark.

Here is the task:
Two pages,
Page one:a long list, spanning many windows down.
Page two:an edit page, letting the user edit One entity from the list, using the post-method.


Each link takes you to a diffrent screen/page that lets you edist the entity that link symbolises using method=post and asp and db. Now, when you have entered the new information in the edit-window I want to go back to the list. Since its so long and the users will want to go through the list, editing one entity at a time, I want to start displaying the list from where they pressed the link. I have the information needed for this, ie the name/number of the entity. When im building the html i could just write the right tag if I knew what it was.

But internal linking on pages requires the querystring method rather than post, right? And I need to use the post method, submitting with a button. And the moment that button is pressed on the edit-page, the list doesent exist yet(its re-rendered each time the user submits since some other user might have changed the list and to give feedback to the user-editing) Isnt there just some tag which tells the browser to start displaying the html from where the tag is placed? Or mebbe i should use javascript to auto-link somehow?

0
Comment
Question by:erikjonsater
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 15

Accepted Solution

by:
VincentPuglia earned 400 total points
ID: 9627159
I'm not exactly certain what the problem is, but you can  return to a specific link on the list page by using anchors like the following:

<a name='link1'>&nbsp;</a>
<a href="#link1" onclick='somefunc(this, 1)'>the link</a>

<a name='link2'>&nbsp;</a>
<a href="#link2" onclick='somefunc(this, 2)'>the link</a>

<a name='link3'>&nbsp;</a>
<a href="#link3" onclick='somefunc(this, 3)'>the link</a>

then when you return to the list, you address it as follows:

"linkpage#link3"

Vinny

0
 
LVL 3

Expert Comment

by:superslamwich
ID: 9630989
I think you're looking for something like this?:


EDIT PAGE
-------------

<style>
span  {
  display:none;
}
</style>

<body>
<span id='s1'>Section 1<p>Blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah </span><p>
<span id='s2'>Section 2<p>Bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh </span><p>
<span id='s3'>Section 3<p>Bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh </span>

<script type='text/javascript'>
args = document.location.search
if(args.length>-1)   {
  args = args.substr(args.indexOf('?') + 1).split('=')[1]
  document.getElementById(args).style.display = "block"
}
</script>


LONG PAGE
--------------

<form action='edit.html' method='post'>
<input type='checkbox' name='ch1' value='s1'><span id='s1'>Section 1<p>Blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah </span><p>
<input type='checkbox' name='ch2' value='s2'><span id='s2'>Section 2<p>Bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh </span><p>
<input type='checkbox' name='ch3' value='s3'><span id='s3'>Section 3<p>Bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh </span><p>
<input type='submit' value='View checked entry">
</form>

{Slam}
0
 
LVL 3

Expert Comment

by:superslamwich
ID: 9631006
few corrections:  you probably want to make those radios with the same name so only one can be selected, and make the last input on the long page:
<input type='submit' value='View selected entry'>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:erikjonsater
ID: 9641939
Many thanx for the advise so far.
Seems Im a very poor comunicator. And im not that good at html either. Ill try these soloutions out tonight, i dont quite understand them yet. Until then, here is a more detailed description if you care to read it(I dont know if the advise you have already given me is anough yet)

The longlist is written in a form, formLonglist.
The link on each row in the longlist calls a javascript function, sending that rows id as parameter.
The javascript function submits the formLonglist, sneaking in the value of the id of the link/entity/row into a hiddenfield in the formlonglist. The javascript function then submits formlonglist. Formlonglist will typically consist of the following form-elements:
id = an int
headercodes = int,int,int ...
rooms=int, int,int ...
state=int  //is analysed at the top of file to determine what im doing next
headercodes are sent along in the formfields. They are originally userinput and controls the number of columns in longlist.
rooms are sent along in the formfields. They are originally userinput and controls the number of rows in the longlist.
id is the id for one row in the longlist.

the editview then lets users edit the database - (edit the subset of headers that the user picked sometime earlier, for the room choosen in longlist)
Once the user presses a button, 'save', in the editview basically the same stuff is submitted in the form 'oneroomForm'. Alot of other stuff is also sent in that form, basically the values to the headercodes:
id=an int, headercodes=1,3,5..
AND
1=value //here the name of the form-element is an int, corresponding to one of the headercodes.
3=value
5=value
..
Now, this stuff is anuff to update the database and to re-render the list from the database. Then i want to somehow tell the browser to start showing the new longlist from the row containing the id that was sent from the edit-view(before that selected by the user from the longlist). Obviously, ill have to do this when im creating the list from db-values. I can find the place since i have the 'id'. But i dont know what to write once i find it because im nogood at html. Maybe i can just concatenate the id onto the action="filename.asp" form in the edit-view, formOneRoom.
0
 

Author Comment

by:erikjonsater
ID: 9642506
vinny's soloution looks promising.(is tonight here now)
0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9642621
Hi erik,

 thank you.  if you need help modifying it, post some example code of the list and state the problem you are having.

Vinny

0
 

Author Comment

by:erikjonsater
ID: 9643640
Thanx Vinny
Well, your soloution works like a charm. Many thanx. By the way, is there any way i can link to the href-tag/anchor? Cause due to legacy this listview is kinda slow(db design is lunatic) as it is and i want to print as little as possible, the extra name-tag/anchour would be nice to do without.
0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9643742
not really,

perhaps the code that produces the list itself can be pared.

Vinny
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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)

670 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