Nested poll - jump to results position not top of page


(Charlotte Westney) #1

Hi everyone,

 

I'm sure this is simple, but I just can't figure it out.

 

I have a poll which I'm going to nest into a few pages across a site. Its going to be nested underneth the main content of the page.  When you click the 'vote' button, the page refreshes and you then have to manually scroll back down again to see the results, which is quite important in this case as we're trying to get people to follow a link we've put on the results screen.

 

So, how do I get the button to show the results copy but to jump to an anchor point so that the user sees the results without having to scroll?

 

Many thanks! Charlie.

 


(Bart Banda) #2

Hi Charlie,

The best method for this is probably to iframe the poll in or use an ajax submit call and response so that the whole page doesn't need to be refreshed. An iframe is a nice an easy method as it also means your main page can be cached and the poll uncached and really easy to implement. 

 

If you really need the whole page to refresh you might have to write some JavaScript that listens out for when a Poll has been submitted, maybe with %globals_post% keywords and then scroll the user down to the poll that way. 


(Charlotte Westney) #3

Hi Bart,

 

Thanks for those suggestions, I'll try an iFrame method.

 

However 'nice and easy to implement' I may need to disagree with.... Nested content works so well because Matrix brings in the page, but it strips out the design around it and just brings in the content. The content is still within your normal divs etc though so all your css styling still applies.

To bring in the page in an iFrame, the page has to exist in a location without the main design applied to it, which means it appears with no styling at all, so I need to make a new customisation to bring in the css onto the otherwise blank html page that its on.. i'm fine doing all that, but its not the quick or easy solution that nested content is, and iFrames aren't as easy for Edit+ authors to put in as a new nested content div either.

 

Unless I'm missing something?

 

What would be ideal would be for it to be nested content, but with the submit button acting through javascript to show/hide divs from the original screen to the new screen, same for forms and asset builders and any asset with multiple bodycopies....   I feel a roadmap new entry coming on!

 

thanks, Charlie.


(Bart Banda) #4

To make it easy for editors, you could always have the iframe content within a standard page that you do nest in anywhere on the page, so that would solve that problem.

 

You would have to create a separate design and maybe some extra css to style the iframe content, but this work is minimal and is only required to be done once. 

 

Alternatively you could use the JS solution so that you can nest as normal and handle the submit and load of results all via AJAX, this would be the nicest solution really but requires some JS knowledge to set up and get going.