logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by luc Betbeder on Fri 21 Oct 2005 in response to Keyword Refresh R2.0

Stop browser jump on Refresh fields keyword change

Thought I would add this here... cause I came here looking for solution to this
problem. Hope it helps others.


Prob
in notes when you do a web refresh - ie to calculate the value of a field based
on other conditions the page will jump - either to the top of the page (bad) or
bring the field you are working on to the top (only slightly better than the
other option)


so... how to fix


Fix


instead of using the field property
"Refresh fields on keyword change"
you use an onclick or an onchange event and use some code like


_doClick('$Refresh',this,null);


this will refresh the page but you still have a problem with the jump but at
least you control the code not domino then


use these javascript functions to capture the current scroll position


function storePos(){
document.cookie = "win_"+window.name+"="+document.body.scrollTop;
}
function lastPos(){
cVal = document.cookie.split("win_"+window.name+"=");
if(cVal.length==2){
window.scrollTo(0,parseInt(cVal[1]));
}
}


put this in the JSheader or wherever you normally put your JS


lastly you need to place


<body onLoad="lastPos()" onScroll="storePos()">


in the body
note that we have onLoad but no onScroll in domino so I just whack it in in
pass-through HTML and domino copes fine



so what happens is on the field being clicked it gets refreshed... and the
current postion is always tracked so the refresh leaves you at the right place


cheers
luc