Author | Topic: rememember position in page | |
---|---|---|
Jeremy Suiter | rememember position in page on Tue, 20 Jun 2006 15:43:15 +0100 Hi All, WAA generates a list page for me that has an edit button on each row and when the edit button is pressed no surprise an edit page for that item is loaded when it's save button is pressed the list page is generated and displayed again. It is in this page I would like to remember what item I was on when the edit button was pressed and jump straight to that item. I've searched the Internet but I can't find anything on it. Anyone have any ideas? Thanks Jeremy | |
Phil Ide | Re: rememember position in page on Tue, 20 Jun 2006 20:23:49 +0100 Jeremy, > WAA generates a list page for me that has an edit button on each row and > when the edit button is pressed no surprise an edit page for that item is > loaded when it's save button is pressed the list page is generated and > displayed again. It is in this page I would like to remember what item I > was on when the edit button was pressed and jump straight to that item. > > I've searched the Internet but I can't find anything on it. Anyone have any > ideas? There are two ways to do this: 1. Normally, you would create a named anchor on the target (1st) page, and in the second page, request the page naming the name: target <a name="here"></a> call: http://myweb.com/thatpage.html#here With WAA , just tack '#' plus the named target onto the end of the uri. This only works with GET data, so you can't do it from a form (maybe you can, I just don't know how). So build a link like this: cForm is the func which generates the page you want cUrl := "/cgi-bin/"+oContext:getScriptName()+'?' now tack on the WAA_PACKAGE and WAA_FORM vars, plus any others cUrl += oHtml:getVar('WAA_PACKAGE')+'&WAA_FORM= the function requires, then: cUrl += '#here' Don't forget to create an anchor with a name (but no href) in the target document. As you have xbHCL to play with, you can add the named anchor like this: A name=here there, easy wasn't it? 2. The other way, is to embed a javascript function in the page, preferably in the onLoad event of the body element: <body onLoad="document.location='#here';"> After the document has loaded and displayed itself, it automatically jumps to the named anchor. In xbHCL, you would do it like this: oBody := MyDoc():doc:DOMReturn('/html/body') undocumented functions oBody:setAttribute( 'onLoad', "document.location='#here';" ) Regards, Phil Ide ----------------------------------------------------------------- xbHCL (http://www.xbHCL.com) Xbase++ HTML command layer PBIH (http://www.pbih.eu) Polar Bear International Hosting ----------------------------------------------------------------- Xbase++ FAQ, Libraries and Sources: http://www.idep.org.uk/xbase Short: Vertically challenged | |
Jeremy Suiter | Re: rememember position in page on Wed, 21 Jun 2006 10:06:38 +0100 Thanks Phil. That's given me what I need to know to put something together. Regards Jeremy "Phil Ide" <phil@pbih.net> wrote in message news:1eiid7yfrbonm$.dlg@pbih.net... > Jeremy, > >> WAA generates a list page for me that has an edit button on each row and >> when the edit button is pressed no surprise an edit page for that item is >> loaded when it's save button is pressed the list page is generated and >> displayed again. It is in this page I would like to remember what item I >> was on when the edit button was pressed and jump straight to that item. >> >> I've searched the Internet but I can't find anything on it. Anyone have >> any >> ideas? > > There are two ways to do this: > > 1. > Normally, you would create a named anchor on the target (1st) page, and in > the second page, request the page naming the name: > > target > <a name="here"></a> > > > call: > http://myweb.com/thatpage.html#here > > With WAA , just tack '#' plus the named target onto the end of the uri. > This > only works with GET data, so you can't do it from a form (maybe you can, I > just don't know how). So build a link like this: > > cForm is the func which generates the page you want > cUrl := "/cgi-bin/"+oContext:getScriptName()+'?' > now tack on the WAA_PACKAGE and WAA_FORM vars, plus any others > cUrl += oHtml:getVar('WAA_PACKAGE')+'&WAA_FORM= > the function requires, then: > cUrl += '#here' > > Don't forget to create an anchor with a name (but no href) in the target > document. > > As you have xbHCL to play with, you can add the named anchor like this: > > A name=here there, easy wasn't it? > > > 2. > The other way, is to embed a javascript function in the page, preferably > in > the onLoad event of the body element: > > <body onLoad="document.location='#here';"> > > After the document has loaded and displayed itself, it automatically jumps > to the named anchor. > > In xbHCL, you would do it like this: > > oBody := MyDoc():doc:DOMReturn('/html/body') undocumented functions > oBody:setAttribute( 'onLoad', "document.location='#here';" ) > > Regards, > -- > Phil Ide > > ----------------------------------------------------------------- > xbHCL (http://www.xbHCL.com) Xbase++ HTML command layer > PBIH (http://www.pbih.eu) Polar Bear International Hosting > ----------------------------------------------------------------- > Xbase++ FAQ, Libraries and Sources: > http://www.idep.org.uk/xbase > > Short: Vertically challenged |