The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
I want to do a US president poll and there are more than 15 running right now. How can I increase the Max. number above 15? Thanks.
Posted
First, you'll need to add additional fields to the forum_polls table, following the same pattern as the ANSWER15, COUNT15 currently provided. To do that, you can either manually add them, or use something like this. It's untested, but should work.
"pollchange.asp"
Look in the following files and change instances of 15 to the desired quantity:
config.asp
Dim strHidePoll, strVResults, PCount, nCount, txtAns(), vPercent(100), vAnswers(15), vCount(15)
active_polls.asp - all
admin_poll.asp - all
inc_poll.asp - all
pop_poll.asp - all
post.asp - those related to poll mod (should be seven)
topic.asp - those related to poll mod (should be twelve)
admin_poll.asp will take a bit more work, sorry. You'll need to expand the <select></select> for strMaxVotes or replace it with a input type=text.
I redid this whole thing on my modular to use a new variable in lieu of the 15 throughout. That way it can be changed in the admin page and not have to edit all the pages each time.
"pollchange.asp"
Code:
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp" -->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
If (Session(strCookieURL & "Approval") <> "15916941253") Or (MemberID <> intAdminMemberID) Then
scriptname = Split(Request.ServerVariables("SCRIPT_NAME"),"/")
Response.Redirect "admin_login.asp?target=" & scriptname(UBound(scriptname)) & "?" & Request.ServerVariables("Query_String")
End If
If Request("Qty") > "" Then
If IsNumeric(Request("Qty")) Then
For i = 16 to 15 + Request("Qty")
strSql = "ALTER TABLE " & strTablePrefix & "POLLS ADD COLUMN ANSWER" & CSTR(I) & " VARCHAR(100) NULL"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
strSql = "ALTER TABLE " & strTablePrefix & "POLLS ADD COLUMN COUNT" & CSTR(I) & " INT NULL 0"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
Next
Response.Write "Completed."
WriteFooter
Response.End
End If
Else
Response.Write "<form action=""pollchange.asp"" method=""post"">" & vbNewLine & _
" <table align=""center"" width=""300"" border=""1"" bgColor=""" & strPageBGColor & """ cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""right"" width=""250"" bgColor=""" & strPopUpTableColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>Additional Answers: </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgColor=""" & strPopUpTableColor & """>" & vbNewLine & _
" <input type=""text"" style=""width:98%; align:center; text-align:center; color:maroon; font-weight:bold;"" name=""Qty"" maxlength=""2"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td style=""line-height:50%;"" bgColor=""transparent"" align=""center"" colspan=""2"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; font-weight:bold; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:"&strHColor&";"" type=""Submit"" class=""button2"" name=""submit"" value=""Submit"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>" & vbNewLine
WriteFooter
End If
%>
Look in the following files and change instances of 15 to the desired quantity:
config.asp
Dim strHidePoll, strVResults, PCount, nCount, txtAns(), vPercent(100), vAnswers(15), vCount(15)
active_polls.asp - all
admin_poll.asp - all
inc_poll.asp - all
pop_poll.asp - all
post.asp - those related to poll mod (should be seven)
topic.asp - those related to poll mod (should be twelve)
admin_poll.asp will take a bit more work, sorry. You'll need to expand the <select></select> for strMaxVotes or replace it with a input type=text.
I redid this whole thing on my modular to use a new variable in lieu of the 15 throughout. That way it can be changed in the admin page and not have to edit all the pages each time.
Last edited by Carefree on 18 December 2015, 11:40
Posted
Thank you!
Posted
You're welcome.
Posted
I wrote my own poll mod years ago. I put my choices on a separate table than the questions. That way you could have as many or few choices as you wanted and their wasn't a lot of wasted space on the Poll table
The code is long gone but the choice columns probably looked something like this.
ChoiceID(auto)- PollID- ChoiceTxt- Votes
The code is long gone but the choice columns probably looked something like this.
ChoiceID(auto)- PollID- ChoiceTxt- Votes
_-/Cripto9t\-_
Email Member
Message Member
Post Moderation
FileUpload
If you're having problems uploading, try choosing a smaller image.
Preview post
Send Topic
Loading...