voting script conflict - The "view results" button cancels out the "vote&

They have: 4 posts

Joined: Jun 1999

I've been using the voting script from BigNosebird.com for quite some time now. (Example: http://www.vegsource.org/tom/poll/)

Now I want to make a modification that allows me to ask a single question at the top of a bulletin board. A person should have the choice of 1)voting and seeing the results generated or 2) only clicking on a "view results" button to see how the votes are coming along.

Unfortunately, whenever I include both a "vote" and a "view results" button on the same page, the latter makes the former one not work. Here's an example:

http://www.vegsource.org/tom/sarah/question6.htm

If you try to vote, you'll see the results calculated, but your vote won't be recorded. The "view results" button works fine, however.

When I have only the vote button on the page, the voting works fine. Example:

http://www.vegsource.org/tom/sarah/question4.htm

If I delete one of the </form> commands, the vote gets recorded, but the script crashes before calculating the results.

I'm not sure what I'm doing wrong. The original BigNosebird.com script has the "vote" button and the "review results" one on separate pages.

I took the vote button from this page:
http://www.vegsource.org/tom/poll/vote8.html

...and spliced it together with the view results one from this page:
http://www.vegsource.org/tom/poll/
(It's named View Poll #8 Current Results there.)

In case it's relevant, this mini-poll will be put on this board when it's done:
http://www.vegsource.org/tom/sarah/sarah1.html

The sarah1.html file there is generated by a cgi script named wwwboard.cgi. I don't expect problems, since I know how to write the print commands that generate HTML.

I'd appreciate any help. Feel free to try test votes on any of the "sarah" links I posted. That is not a real survey yet.

However, please do not vote in the Party of Five survey (http://www.vegsource.org/tom/poll/) unless you follow that show. It's a real survey that's been up collecting votes for some months. Thanx.

They have: 5,633 posts

Joined: Jan 1970

The problem is that you have the "action" field set twice. In HTML, the forms are loaded, and the hidden fields can only have one value, so the action field will have the value that you set the second time.

I would suggest that you get rid of the hidden "action" fields and use the submit buttons to specify action. There's one flaw, though -- You must change the text that the buttons show (currently "VOTE!" and "View Results") to "VOTE" and "VIEW".

Be sure to set the name of the submit buttons to "action" ... like this:

<input type="submit" name="action" value="VOTE">
<input type="submit" name="action" value="VIEW">

Regards,
Federico

They have: 4 posts

Joined: Jun 1999

Thank you very much. That did the trick.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.