Solved

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

Posted on 2007-11-28
4
153 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now