|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Hi -b, If you want a page to be scrolled to the same scroll position as when a form within that page is submitted, I may be able to help as that is something I did recently. This is a crude solution using html and _javascript_, but worked well enough for me. In the page head section, include these _javascript_ functions: // Record the document scroll position in our hidden field that has id 'hidScroll' function recordScroll(thisPage) { //alert("pos: " + document.body.scrollTop); var hidScroll = document.getElementById('hidScroll'); hidScroll.value = document.body.scrollTop; } // Get the value from the hidden field identified by id 'hidScrollReturn' which is // passed back the previous scroll position from the server with each refresh function goToScroll() { var hidScrollReturn = document.getElementById('hidScrollReturn'); //alert("hidScrollReturn value: " + hidScrollReturn.value); document.body.scrollTop = hidScrollReturn.value; } </script> Then include this in the <body... to force the page to go to the returned scroll position when it has loaded and also to record the latest scroll position after each scroll event. <!-- Note that onscroll seems to run before onload triggers, which is why there has to be a separate hidden field for returning the value (if the same field is used, the onscroll clears it back to zero before the onload has time to goToScroll) --> <body onload="goToScroll();" onscroll="recordScroll(this)"> Include two hidden fields in the form that is being submitted, defined in the wod like this: hiddenScrollPosField: WOTextField { id = "hidScroll"; type = "hidden"; value = scrollPosition; } hiddenScrollPosReturnField: WOTextField { id = "hidScrollReturn"; type = "hidden"; value = scrollReturnPosition; } The component java class then has variables that accept the latest scroll position when the form is submitted and one to pass the scroll position back when the page is returned. John On 25 Mar 2008, at 16:32, Anthony B Arthur wrote:
|
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
| References: | |
| >scroll to anchor (From: Anthony B Arthur <email@hidden>) |
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.