PDA

View Full Version : Poll widget/tutorial?



marynorn
05-21-2008, 10:05 AM
I need a teeny tiny little poll in the sidebar of my website. Just two radio buttons, which when submitted show two sliding scales. 25% Yes, 75% No, that sort of thing.

I've found a lot of hugely complex ways to do this, with dozens of xml, js, css, php, blah blah blah files to download and trawl through. Is there no simplified version or tutorial out there that shows pared-down, no-frills, code?

jscheuer1
05-21-2008, 10:24 AM
You need some type of server side language for a poll. Javascript alone cannot store and retrieve the data necessary to keep track of things. In fact, a poll that doesn't rely on javascript is best, so it can be available to users without javascript enabled. Generally a good poll setup will use javascript only as an enhancement if at all. You may be able to find a third party add on that could simplify things somewhat and that will do the data base part using its servers:

http://www.google.com/search?hl=en&client=opera&rls=en&hs=CmQ&q=%22poll+for+your+website%22&btnG=Search

marynorn
05-21-2008, 10:53 AM
I was thinking something along the lines of Ajax. Server-side requires the page to reload before displaying results, which isn't ideal. Certainly for storing results, I'll need to have a php connection to the server, but for the poll itself, I'd prefer client-side scripting.

Medyman
05-21-2008, 12:08 PM
It requires both types of technologies. As John stated, you'll need server-side scripting not only for storing the results, but also to update/output the results. The actual form elements etc... are going to be HTML with some javascript.

In any case, here (http://www.somecoders.com/2006/05/make-an-ajax-poll/) is a tutorial on how to make an Ajax poll.