Solved

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

Posted on 2007-11-28
4
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

726 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