Solved

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

Posted on 2007-11-28
4
163 Views
Last Modified: 2010-04-09
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
Comment
Question by:erin027
  • 3
4 Comments
 

Accepted Solution

by:
avwa earned 250 total points
ID: 20371584
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
 

Author Comment

by:erin027
ID: 20371625
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
 

Author Comment

by:erin027
ID: 20371656
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
 

Author Comment

by:erin027
ID: 20371715
I got it.
I should've used the Cint like this:
 <%if cint(request("MemberTypeID"))=rs1("MemberTypeID") then%>
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question