Solved

Choosing where to start displaying a page

Posted on 2003-10-27
8
161 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 15

Accepted Solution

by:
VincentPuglia earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:erikjonsater
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

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

Expert Comment

by:VincentPuglia
Comment Utility
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
Comment Utility
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
Comment Utility
not really,

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

Vinny
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

743 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

8 Experts available now in Live!

Get 1:1 Help Now