Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 30th, 2006, 12:50 PM
Authorized User
 
Join Date: Feb 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with submiting and checkboxes

Hi ,
i created 7 combo boxed - each of them should become checked and disabled on 'onclick' event. When i choose first checkbox it works fine , but each of the next clicks erases the last choice , so in each click i can see only one disabled selected checkbox - But i need it to remember all the choices . when i worked with Asp.NET there was a thing called 'ViewState' - and this is what i need here , but i can't make it work . Here is the code i used :

do while not mainRs.EOF

                           if (mainRs(30) <> "" and mainRs(29) <> "") then
                           if (( ( day(Date())<day(mainRs(29)) and month(Date())<=month(mainRs(29)) ) or ( (day(Date()) >= day(mainRs(29)) ) and ( month(Date()) < month(mainRs(29)) ) ) ) or ( ((day(Date()) = day(mainRs(29)))and(month(Date()) = month(mainRs(29))))and((hour(Time())<hour(mainRs(3 0)))or((hour(Time()) = hour(mainRs(30)))and(minute(Time()) < minute(mainRs(30))))) ) ) then
                            firstTypeCounter = firstTypeCounter + 1
                            %>
                      <form id="frm<%=firstTypeCounter%>" method="post" action="game.asp?CatID=<%Response.Write(Request.Qu eryString("CatID"))%>&GameID=<%Response.Write(Requ est.QueryString("GameID"))%>&lang=<%Response.Write (Request.QueryString("lang"))%>">
                              <tr bgcolor="FCFAFA">

                                <td width="57" class="tdlineviewtablecellside211" dir="ltr"><% Response.Write(mainRs(29)) %></td>
                                <td width="3"><img height="1" src="../images/1x1.gif" width="1"></td>
                                <td width="66" class="tdlineviewtablecellside212" dir="ltr"><% Response.Write(mainRs(3+lang)) %></td>
                                <td colspan="2" class="tdlineviewtablecellside212">
                                <%
                                   if(((cint(Minute(mainRs(30))) - cint(Minute(Time())) <= 10) ) and (cint(Hour(mainRs(30))) = cint(Hour(Time()))) and (cint(Day(Date())) = cint(Day(mainRs(29)))) and (cint(Month(Date())) = cint(Month(mainRs(29)))) ) then
                                %>
                                <img src="images/bullet.gif" width="10" height="10">
                                <%
                                   end if
                                %>
                                </td>
                                <td width="36" align="left" class="tdlineviewtablecellside212"><div align="center">
                                <%
                                if (mainRs(7) <> "") then
                                %>
                                <%
                                  ' Response.Write("<script language='JavaScript'>alert('" & "checkbox" & Request.QueryString("CatID") & Request.QueryString("GameID") & mainRs(2) & "---" & Request.Form("checkbox" & Request.QueryString("CatID") & Request.QueryString("GameID") & mainRs(2)) & "');</script>")
                                %>
                                <input type="checkbox" name="checkbox<%=Request.QueryString("CatID")%><%= Request.QueryString("GameID")%><%=mainRs(2)%>1" value="1" onclick="SubmitForm('frm<%=firstTypeCounter%>');" <%if(Request.Form("checkbox" & Request.QueryString("CatID") & Request.QueryString("GameID") & mainRs(2) & "1")="1") then Response.Write("checked disabled") end if%>><input type="hidden" name="chkTypeID" value="1"><input type="hidden" name="chkGambleID" value="<%=mainRs(2)%>">
                                <%
                                end if
                                %>


                                </div></td>
                                <td width="54" class="tdlineviewtablecellside211" dir="ltr">
                                <%
                                      if(isUS = "US") then
                                      if (mainRs(7) <> "") then
                                         if (cdbl(mainRs(7)) >= 2) then
                                            Response.Write(cint(((cdbl(mainRs(7)))-1)*100))
                                         elseif (cdbl(mainRs(7)) < 2 and cdbl(mainRs(7)) > 1) then
                                            Response.Write(cint((-100/((cdbl(mainRs(7)))-1))))
                                         end if
                                          else
                                          Response.Write(mainRs(7))
                                         end if
                                      else
                                         Response.Write(mainRs(7))
                                      end if
                                %>
                                </td>
                                <td width="6"><img height="1" src="/10BetClient/images/1x1.gif" width="1"></td>
                                <td width="10" class="tdlineviewtablecellside212">
                                <% if (((cint(Minute(mainRs(30))) - cint(Minute(Time())) <= 10) ) and (cint(Hour(mainRs(30))) = cint(Hour(Time()))) and (cint(Day(Date())) = cint(Day(mainRs(29)))) and (cint(Month(Date())) = cint(Month(mainRs(29))) )) then %>
                                <img src="images/bullet.gif" width="10" height="10">
                                <% end if %>
                                </td>
                                <td width="36" align="left" class="tdlineviewtablecellside212"><div align="center">
                                <%
                                   if(mainRs(8) <> "") then
                                %>
                                <%'Response.Write("<script language='JavaScript'>alert('" & firstTypeCounter & "');</script>")%>
                                <input type="checkbox" name="checkbox<%=Request.QueryString("CatID")%><%= Request.QueryString("GameID")%><%=mainRs(2)%>2" value="1" onclick="SubmitForm('frm<%=firstTypeCounter%>');" <%if (Request.Form("checkbox" & Request.QueryString("CatID") & Request.QueryString("GameID") & mainRs(2) & "2" ) <> "") then Response.Write("checked disabled") end if%>><input type="hidden" name="chkTypeID" value="2"><input type="hidden" name="chkGambleID" value="<%=mainRs(2)%>">
                                <%
                                  end if
                                %>

                                </div></td>
                                <td width="42" dir="ltr" class="tdlineviewtablecellside211"><% Response.Write(mainRs(15)) %></td>
                                <td width="54" class="tdlineviewtablecellside211" dir="ltr">
                                <%
                                      if(isUS = "US") then
                                      if (mainRs(8) <> "") then
                                         if (cdbl(mainRs(8)) >= 2) then
                                            Response.Write(cint(((cdbl(mainRs(8)))-1)*100))
                                         elseif (cdbl(mainRs(8)) < 2 and cdbl(mainRs(8)) > 1) then
                                            Response.Write(cint((-100/((cdbl(mainRs(8)))-1))))
                                         end if
                                          else
                                          Response.Write(mainRs(8))
                                         end if
                                      else
                                         Response.Write(mainRs(8))
                                      end if
                                %>
                                </td>
                                <td width="6"><img height="1" src="/10BetClient/images/1x1.gif" width="1"></td>
                                <td width="10" class="tdlineviewtablecellside212">
                                <%
                                 if (((cint(Minute(mainRs(30))) - cint(Minute(Time())) <= 10) ) and (cint(Hour(mainRs(30))) = cint(Hour(Time()))) and (cint(Day(Date())) = cint(Day(mainRs(29)))) and (cint(Month(Date())) = cint(Month(mainRs(29))) )) then
                                %>
                                <img src="images/bullet.gif" width="10" height="10">
                                <%
                                  end if
                                %>
                                </td>
                                <td width="36" align="left" class="tdlineviewtablecellside212"><div align="center">
                                <%
                                   if (mainRs(9) <> "") then
                                %>
                                <input type="checkbox" name="checkbox<%=Request.QueryString("CatID")%><%= Request.QueryString("GameID")%><%=mainRs(2)%>3" value="1" onclick="SubmitForm('frm<%=firstTypeCounter%>');" <% if (Request.Form("checkbox" & Request.QueryString("CatID") & Request.QueryString("GameID") & mainRs(2) & "3") = "1") then Response.Write("checked disabled") end if%>><input type="hidden" name="chkTypeID" value="3"><input type="hidden" name="chkGambleID" value="<%=mainRs(2)%>">

                                <%
                                   end if
                                %>
........

 
Old October 30th, 2006, 02:26 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Viewstate was not introduced until .NET thus it is not available in Classic ASP; since you are using javascript to facilitate this, you will have to adjust your javascript to not uncheck the boxes that have been previously checked.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old October 30th, 2006, 02:30 PM
Authorized User
 
Join Date: Feb 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there a code for this?

 
Old October 30th, 2006, 02:39 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Yes; google for references to document.form.element.checked

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with checkboxes with submittion Paula222 Classic ASP Basics 0 October 30th, 2006 12:42 PM
problem with foreach loop in Checkboxes datagrid mbge9pjb .NET Framework 2.0 2 December 20th, 2005 10:03 AM
Problem Pre Selecting CheckBoxes in a CheckBoxLis sandersbr ASP.NET 1.0 and 1.1 Basics 2 August 13th, 2004 08:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.