Skip to main content
Known Participant
January 18, 2010
Question

Dynamic List/Menu ASP Selection won't go to record

  • January 18, 2010
  • 2 replies
  • 917 views

Hi,

I have an update record form and I need to go directly to a record by selecting the date from a drop down box. (There is only 1 date per record)

The list/menu picks up the dates correctly, but does not do anything more.

The code is:

<select name="DateSelector" id="DateSelector">
                  <option value="0" <%If (Not isNull((rsResults.Fields.Item("Date").Value))) Then If ("0" = CStr((rsResults.Fields.Item("Date").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Select Date...</option>
                  <%
While (NOT rsResults.EOF)
%><option value="<%=(rsResults.Fields.Item("Date").Value)%>" <%If (Not isNull((rsResults.Fields.Item("Date").Value))) Then If (CStr(rsResults.Fields.Item("Date").Value) = CStr((rsResults.Fields.Item("Date").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsResults.Fields.Item("Date").Value)%></option>
                  <%
  rsResults.MoveNext()
Wend
If (rsResults.CursorType > 0) Then
  rsResults.MoveFirst
Else
  rsResults.Requery
End If
%>
                </select>

Do I need a got to record button as weel?

Any help greatly appreciated.

John

[Moved to Dreamweaver Application Development forum by moderator]

This topic has been closed for replies.

2 replies

Known Participant
January 18, 2010

Many thanks for your reply, detailed for code as follows:

<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" id="form1">
          <table align="center">
            <tr valign="baseline">
              <td align="right" nowrap="nowrap"> </td>
              <td><%session.lcid=2057%>
                <select name="select" id="select">
                  <%
While (NOT rsDates.EOF)
%><option value="<%=(rsDates.Fields.Item("ID").Value)%>" <%If (Not isNull((rsResults.Fields.Item("ID").Value))) Then If (CStr(rsDates.Fields.Item("ID").Value) = CStr((rsResults.Fields.Item("ID").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsDates.Fields.Item("Date").Value)%></option>
                  <%
  rsDates.MoveNext()
Wend
If (rsDates.CursorType > 0) Then
  rsDates.MoveFirst
Else
  rsDates.Requery
End If
%>
                </select>
Go</td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td colspan="5"> </td>
            </tr>
            <tr valign="baseline">
              <td width="100" align="right" nowrap="nowrap"><%=(rsResults.Fields.Item("Date").Value)%></td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td width="65"> </td>
              <td colspan="5"><%
  '...
    
   If rsResults("Verified")= -1 then
   Response.Write "Result Verified"
   Else Response.Write "This Result Has Not Been Verified"
   End If
  '...
%></td>
            </tr>
            <tr valign="baseline">
              <td width="100" align="right" nowrap="nowrap">HOME</td>
              <td>SCORE</td>
              <td> </td>
              <td>Wkts</td>
              <td>Pts</td>
              <td width="65"><div align="center">Win</div></td>
              <td width="65"><div align="center">Lose</div></td>
              <td width="40"><div align="center">Draw</div></td>
              <td width="65"><div align="center">Tie</div></td>
              <td width="65"><div align="center">Cancelled</div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td width="100" align="right" nowrap="nowrap"><%=(rsResults.Fields.Item("Home_Club").Value)%></td>
              <td><input name="Score_Home" type="text" class="textfield" value="<%=(rsResults.Fields.Item("Score_Home").Value)%>" size="9"/></td>
              <td> </td>
              <td><input name="Wkts_Home" type="text" class="textfield" value="<%=(rsResults.Fields.Item("Wkts_Home").Value)%>" size="3" /></td>
              <td><input name="Points_Home" type="text" class="textfield" value="<%=(rsResults.Fields.Item("Points_Home").Value)%>" size="3" /></td>
              <td width="65"><div align="center">
                <input name="HomeRadio"  type="radio" class="radiobutton" id="HomeRadio" value=1 <%If (CStr((rsResults.Fields.Item("Home_Result").Value & "")) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td width="65"><div align="center">
                <input name="HomeRadio" type="radio" class="radiobutton" id="HomeRadio2" value=2 <%If (CStr((rsResults.Fields.Item("Home_Result").Value & "")) = CStr("2")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td><div align="center">
                <input name="HomeRadio" type="radio" class="radiobutton" id="HomeRadio3" value=3 <%If (CStr((rsResults.Fields.Item("Home_Result").Value & "")) = CStr("3")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td width="65"><div align="center">
                <input name="HomeRadio" type="radio" class="radiobutton" id="HomeRadio4" value=4 <%If (CStr((rsResults.Fields.Item("Home_Result").Value & "")) = CStr("4")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td width="65"><div align="center">
                <input name="HomeRadio" type="radio" class="radiobutton" id="HomeRadio5" value=5 <%If (CStr((rsResults.Fields.Item("Home_Result").Value & "")) = CStr("5")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td width="100" align="right" nowrap="nowrap">
              V:</td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td width="65"> </td>
              <td width="65"> </td>
              <td> </td>
              <td width="65"> </td>
              <td width="65"> </td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td width="100" align="right" nowrap="nowrap">AWAY</td>
              <td>SCORE</td>
              <td> </td>
              <td>Wkts</td>
              <td>Pts</td>
              <td width="65"><div align="center">Win</div></td>
              <td width="65"><div align="center">Lose</div></td>
              <td><div align="center">Draw</div></td>
              <td width="65"><div align="center">Tie</div></td>
              <td width="65"><div align="center">Cancelled</div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td width="100" align="right" nowrap="nowrap"><%=(rsResults.Fields.Item("Away_CLub").Value)%></td>
              <td><input name="Score_Away" type="text" class="textfield" value="<%=(rsResults.Fields.Item("Score_Away").Value)%>" size="9" /></td>
              <td> </td>
              <td><input name="Wkts_Away" type="text" class="textfield" value="<%=(rsResults.Fields.Item("Wkts_Away").Value)%>" size="3" /></td>
              <td><input name="Points_Away" type="text" class="textfield" value="<%=(rsResults.Fields.Item("Points_Away").Value)%>" size="3" /></td>
              <td width="65"><div align="center">
                <input name="AwayRadio" type="radio" class="radiobutton" id="AwayRadio" value=1 <%If (CStr((rsResults.Fields.Item("Away_Result").Value & "")) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td width="65"><div align="center">
                <input name="AwayRadio" type="radio" class="radiobutton" id="AwayRadio2" value=2 <%If (CStr((rsResults.Fields.Item("Away_Result").Value & "")) = CStr("2")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td><div align="center">
                <input name="AwayRadio" type="radio" class="radiobutton" id="AwayRadio3" value=3 <%If (CStr((rsResults.Fields.Item("Away_Result").Value & "")) = CStr("3")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td width="65"><div align="center">
                <input name="AwayRadio" type="radio" class="radiobutton" id="AwayRadio4" value=4 <%If (CStr((rsResults.Fields.Item("Away_Result").Value & "")) = CStr("4")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td width="65"><div align="center">
                <input name="AwayRadio" type="radio" class="radiobutton" id="AwayRadio5" value=5 <%If (CStr((rsResults.Fields.Item("Away_Result").Value & "")) = CStr("5")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
              </div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td width="100" align="right" nowrap="nowrap"> </td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td width="65"> </td>
              <td width="65"> </td>
              <td> </td>
              <td width="65"> </td>
              <td width="65"> </td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td colspan="11" align="right" nowrap="nowrap"><div align="center" class="DonCrouchHeader">DON CROUCH TROPHY POINTS</div></td>
            </tr>
            <tr valign="baseline">
              <td colspan="11" align="right" nowrap="nowrap"><div align="center">SELECT THE APPROPRIATE BUTTON AGAINST EACH SECTION. UNACCEPTABLE = 0, ACCEPTABLE = 1, GOOD = 2.<br />
              THESE SCORES ARE NOT VISIBLE TO THE OPPOSING TEAM.</div></td>
            </tr>
            <tr valign="baseline">
              <td align="right" nowrap="nowrap"> </td>
              <td colspan="5"> </td>
              <td width="65"> </td>
              <td><div align="center">Unacceptable</div></td>
              <td width="65"><div align="center">Acceptable</div></td>
              <td width="65"><div align="center">Good</div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td colspan="6" align="right" nowrap="nowrap">Counduct, Resposibility and Sociability of Visiting Captain</td>
              <td align="right" nowrap="nowrap"> </td>
              <td><div align="center"><input name="DCCaptain" type="radio" class="radiobutton" id="DCCaptain_0" value="0" <%If (CStr((rsResults.Fields.Item("AwayDCCaptain").Value & "")) = CStr("0")) Then Response.Write("checked=""checked""") : Response.Write("")%> /></div></td>
              <td><div align="center"><input name="DCCaptain" type="radio" class="radiobutton" id="DCCaptain_1" value="1" <%If (CStr((rsResults.Fields.Item("AwayDCCaptain").Value & "")) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> /></div></td>
              <td><div align="center"><input name="DCCaptain" type="radio" class="radiobutton" id="DCCaptain_2" value="2" <%If (CStr((rsResults.Fields.Item("AwayDCCaptain").Value & "")) = CStr("2")) Then Response.Write("checked=""checked""") : Response.Write("")%> /></div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td colspan="6" align="right" nowrap="nowrap">Counduct of Visiting Team OFF the field of play</td>
              <td align="right" nowrap="nowrap"> </td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCTeamOff").Value & "")) = CStr("0")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="TeamOFF" type="radio" class="radiobutton" id="TeamOff_0" value="0" /></div></td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCTeamOff").Value & "")) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="TeamOFF" type="radio" class="radiobutton" id="TeamOff_1" value="1" /></div></td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCTeamOff").Value & "")) = CStr("2")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="TeamOFF" type="radio" class="radiobutton" id="TeamOff_2" value="2" /></div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td colspan="6" align="right" nowrap="nowrap">Counduct of Visiting Team ON the field of play</td>
              <td align="right" nowrap="nowrap"> </td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCTeamOn").Value & "")) = CStr("0")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="TeamOn" type="radio" class="radiobutton" id="TeamOn_0" value="0" />
              </div></td>
              <td width="65"><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCTeamOn").Value & "")) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="TeamOn" type="radio" class="radiobutton" id="TeamOn_1" value="1" />
              </div></td>
              <td width="65"><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCTeamOn").Value & "")) = CStr("2")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="TeamOn" type="radio" class="radiobutton" id="TeamOn_2" value="2" />
              </div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td colspan="6" align="right" nowrap="nowrap">Conduct of Individual Members of Visiting Team</td>
              <td align="right" nowrap="nowrap"> </td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCIndividual").Value & "")) = CStr("0")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="Members" type="radio" class="radiobutton" id="Members_0" value="0" />
              </div></td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCIndividual").Value & "")) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="Members" type="radio" class="radiobutton" id="Members_1" value="1" />
              </div></td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCIndividual").Value & "")) = CStr("2")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="Members" type="radio" class="radiobutton" id="Members_2" value="2" />
              </div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td colspan="6" align="right" nowrap="nowrap">Acceptance of Umpires decisions by Visiting Players</td>
              <td align="right" nowrap="nowrap"> </td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCUmpires").Value & "")) = CStr("0")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="Umpires" type="radio" class="radiobutton" id="Umpires_0" value="0" />
              </div></td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCUmpires").Value & "")) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="Umpires" type="radio" class="radiobutton" id="Umpires_1" value="1" />
              </div></td>
              <td><div align="center"><input <%If (CStr((rsResults.Fields.Item("AwayDCUmpires").Value & "")) = CStr("2")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="Umpires" type="radio" class="radiobutton" id="Umpires_2" value="2" />
              </div></td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td colspan="6" align="right" nowrap="nowrap"> </td>
              <td align="right" nowrap="nowrap"> </td>
              <td> </td>
              <td> </td>
              <td> </td>
              <td> </td>
            </tr>
            <tr valign="baseline">
              <td colspan="11" align="right" nowrap="nowrap"><div align="center">
                  <input type="submit" value="Update Record" />
                  </div></td>
            </tr>
                    </table>
         
         
          <input type="hidden" name="Last_Update" value=<%session.lcid=2057%>"<%=Now()%>"/>
          <input type="hidden" name="HomeUser" value="<%=(rsResults.Fields.Item("HomeUser").Value)%>" size="32" />
          <input type="hidden" name="HomeMainCode" value="<%=(rsResults.Fields.Item("HomeMainCode").Value)%>" size="32" />
          <input type="hidden" name="HomeDivCode" value="<%=(rsResults.Fields.Item("HomeDivCode").Value)%>" size="32" />
          <input type="hidden" name="AwayUser" value="<%=(rsResults.Fields.Item("AwayUser").Value)%>" size="32" />
          <input type="hidden" name="AwayMainCode" value="<%=(rsResults.Fields.Item("AwayMainCode").Value)%>" size="32" />
          <input type="hidden" name="AwayDivCode" value="<%=(rsResults.Fields.Item("AwayDivCode").Value)%>" size="32" />
          <input type="hidden" name="Div" value="<%=(rsResults.Fields.Item("Div").Value)%>" size="32" />
          <input type="hidden" name="MM_update" value="form1" />
          <input type="hidden" name="MM_recordId" value="<%= rsResults.Fields.Item("ID").Value %>" />
        </form>

Participating Frequently
January 18, 2010

Your form is submitting to MM_editAction but you didn't show where that is being populated. Are you trying to use the same page/form to select the record and update it?

Participating Frequently
January 19, 2010

Many thanks for your kind interest

Yes, I am trying to use the same page/form to select the record and update it. Is this where I am going wrong? Should I have a secon form on the same page?

Regards


>Yes, I am trying to use the same page/form to select the record and updat

While it is technically possible to use the same page, I'm not sure if the DW behaviors support it. The update behavior is usually implemented as a master/detail set, where you select the record from a master page and update it on the detail page. The problem with having them on the same page is that the update behavior expects an id. When you first open the page, the id will not have been populated, so you would need to account for that by adding some code manually. But you should be able to get it to work.

>Should I have a secon form on the same page?

Absolutely, you need two forms on the page, and two recordsets. One to select the record and one to update it.

Participating Frequently
January 18, 2010

Yes. The script you provided only shows the population of a drop down. You need to then do something with the selected value. You haven't posted the entire form code, so it's hard to say what else needs to be done.