• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

When user select a value from Select Menu, I want that value to be selected.

Hi.
What I wanted to do was when user select a value from Select form, I want the value to be selected when it refreshes. All the function is working perfected but for some reason select menu doesn't select the value that user selected.
Please help me!


<%
If request("MemberTypeID") = "" then
      MemberTypeID=Null
else
      MemberTypeID=request("MemberTypeID")
End if%>


<script>
function fn_change_MemberTypeID(o){
            var membertypeid=o.MemberTypeID.value;
            if(membertypeid>0) {
            o.action="member.asp?MemberTypeID="+membertypeid;
            o.submit();
            }

}      

-->
</script>

<select name="MemberTypeID" onChange="javascript:fn_change_MemberTypeID(document.form);return false;">
<option value="">All User Group</option>

<%
i=1
Do until rs1.EOF
%>
<option value="<%=rs1("MemberTypeID")%>" <%if request("MemberTypeID")=rs1("MemberTypeID") then%>selected="selected"<%end if%>><%=rs1("MemberTypeName")%></option>
<%
rs1.MoveNext
i=i+1
%>
                        
                    </select>
0
erin027
Asked:
erin027
  • 3
1 Solution
 
avwaCommented:
maybe this is the problem:
to get value of the select:
var membertypeid=o.MemberTypeID.options[o.MemberTypeID.selectedIndex]

also document.form may have to be document.forms[0]
0
 
erin027Author Commented:
I am sorry avwa:
I used var membertypeid=o.MemberTypeID.options[o.MemberTypeID.selectedIndex] and it's not even loading the page.
Any other suggestion?
Thanks
0
 
erin027Author Commented:
I have a similar question.
All I want to do is mark the category name with <strong></strong>when user clicks that Category.
I checked the values separately and request("CategoryID") = rs00("CategoryID") matches, but I have no idea why it's not working.

<%Do until rs00.EOF%>
<tr>
<td height="25">&middot;
 <a href="../admin/board/board.asp?CategoryID=<%=rs00("CategoryID")%>">
                                      <%if request("CategoryID") = rs00("CategoryID") then%>
                                      <strong><%=rs00("CategoryName")%></strong>
                                      <%else%>
                                      <%=rs00("CategoryName")%>
                                      <%end if%>
                                      </a></td>
 </tr>
<%
rs00.MoveNext
i=i+1
loop
%>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
0
 
erin027Author Commented:
I got it.
I should've used the Cint like this:
 <%if cint(request("MemberTypeID"))=rs1("MemberTypeID") then%>
Thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now