also, that solution doesn't keep the focus on a particular field - it
just scrolls back to where the screen was before the submit


On 7/6/06, Jer Kah <[EMAIL PROTECTED]> wrote:
I haven't tried this with dropdowns, but this is what I use for
linksubmits. It has some caveats though:  It has to be used within a
form named Form0 and it doesn't work with directLinks (I think)...
It'd be nice if someone could help a brother out to fix the Form0
thing and put it on tassel...



submitPersistence.html:
<span jwcid="@Script" script="submitPersistence.script"/>
<input jwcid="[EMAIL PROTECTED]" id="ScrollY" value="ognl:y"/>


submitPersistence.jwc:
<?xml version="1.0"?>
<!DOCTYPE component-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0_3.dtd";>
<component-specification allow-body="no" allow-informal-parameters="no">
    <property-specification name="y" type="int" persistent="yes"/>
</component-specification>


submitPersistence.script:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script PUBLIC "-//Apache Software Foundation//Tapestry
Script Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd";>

<script>
<body>
    <![CDATA[
        function saveScrollY() {
                if (document.documentElement )
                        document.Form0.ScrollY.value = 
document.documentElement.scrollTop;
                else if (document.body)
                        document.Form0.ScrollY.value = document.body.scrollTop
                else
                        document.Form0.ScrollY.value = 
document.documentElement.scrollTop;
        }


        function clearScrollY() {
                        document.Form0.ScrollY.value = 0;
        }


        function resetScrollPosition() {
                var  hidy;
                hidy = document.Form0.ScrollY;
                if (typeof hidy != 'undefined') {
                        window.scrollTo(0, hidy.value);
                }
        }
]]>
</body>
 <initialization>
        resetScrollPosition();
 </initialization>
</script>





So to use it, I do:

<form jwcid="[EMAIL PROTECTED]"  listener="ognl:listeners.submitListener" >
<span jwcid="@submitPersistence"  />
...
<a jwcid="@LinkSubmit"  onClick="saveScrollY();"
selected="ognl:moveDownItem" tag="ognl:currentStep" > move down </a>
...
</form>



-jer





On 7/6/06, James Carman <[EMAIL PROTECTED]> wrote:
> All,
>
> Does anyone know how to get Tapestry to "stay put" on a screen when you
> submit the form and reshow it?  I have a form that is somewhat long.  When I
> use an event (like selecting something in a drop-down box) that forces a
> form submit to refresh some other parts of the screen, the screen goes back
> up to the top.  I would like it to just stay where it is (somewhere near the
> originating drop-down).  Any ideas?
>
> James
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to