Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

744 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

16 Experts available now in Live!

Get 1:1 Help Now