+ Start a Discussion
Baird_SBaird_S 

Question: Can I refresh to top of VF page on submit() without using javascript?

I'm a newbie at this, but thought I'd better find out if I could do this in native VF before I start fiddling with javascript.

 

I've created a VF survey that runs inside a Drupal i-frame.  Some of the survey pages are long, and require scrolling to the bottom.  When users click "Next Page," they end up seeing a lot of blank space at the bottom of the iframe, and have to figure out that they should scroll back to the top to the beginning of the next page.  As you VF programmers probably know, not all users figure this out, and the multiple scroll bars confuse them.

 

We've tried javascript for window resizing.  The problem with javascript so far is that it conflicts with the jquery SF uses for things like lookup buttons and multi-picklists, so putting the page resizing javascript on pages with those features breaks the SF functionality.

 

Is there a simple VF way to the "Next Page" button to go to the top of the i-frame?

 

Thanks,

Baird

Ramana.r.sfRamana.r.sf


If you want to control when your array gets refreshed wrap it in an outputpanel and put its id in the rerender attribute of whatever causes the data to need an update. I had to use this previously to reattach some custom jQuery input listeners when every the dom was re-updated.

<apex:commandButtonaction="{!something}"rerender="scriptPanel"/>
<apex:outputPanelid="scriptPanel>
 
<script>
     d
=newArray();
     
<apex:repeat value="{!objects}"var="object">
       d
.push({
           element1
:"{!objects.id}"            
       
});
     
</apex:repeat>
 
</script>
</apex:outputPanel>
Baird_SBaird_S

Thanks Ramana.  Will this work if the VF and the Drupal website reside on different servers?