Results 1 to 5 of 5

Thread: Urgent help please!! - NEWBIE

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Angry

    Hi,

    I have a listbox and submit button on my asp page now,
    I want to go to 1 of 2 pages depending on what the user clicked in the listbox(drop down menu).


    My listbox's name is lstchoice

    I tried something like this, but it does not work...

    <%if lstchoice = "MONDAY" then%>
    <form method="post" action="monday.asp">
    <%else%>
    <form method="post" action="other.asp">
    <%end if%>


    ie. when the user clicks SUBMIT the correct page is opened.

    Am I totally of the track here???

    PLEASE - any help.






  2. #2
    Guest
    Hi, why not try something like:

    ------------------------------------------
    <script language="javascript">
    function whereto()
    {
    switch ( document.myform.lstchoice )
    {
    case ("monday") : window.parent.location.href = "monday.asp";
    break;
    case ("tuesday") : window.parent.location.href = "tuesday.asp";
    break;
    }
    }
    </script>

    <form name="myform" method="post" onsubmit="whereto()">
    -------------------------------------------

    I'm not 100% sure about the "document.myform.lstchoice" syntax, but that's just a minor detail, right?

    Marcel

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343
    Thanks MarcelB,

    I've never worked with javascript, but will give it a try.

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    This will do what your looking for:

    Code:
    <%@ Language=VBScript %>
    <%
    Dim intLoop
    %>
    <HTML>
    <HEAD>
    <SCRIPT language="VBScript">
    <!--
    Sub cmdEnter_onclick
    	Dim intValue
    	intValue = frmForm1.lstList.options(frmForm1.lstList.selectedIndex).Value
    	If CInt(intValue) > 5 Then
    		frmForm1.submit
    	Else
    		frmForm1.action="Page3.asp"
    		frmForm1.submit
    	End If
    End Sub
    
    -->
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM name=frmForm1 id=frmForm1 action="Page2.asp" method=post>
       <SELECT id=lstList name=lstList size=10 style="width: 75px">
          <%for intLoop = 1 to 10
    	   Response.Write "<OPTION value=" & intloop & ">" & intLoop & "</OPTION>"
          Next%>
       </SELECT>
       <INPUT TYPE="button" id=cmdEnter NAME=cmdEnter VALUE="Enter">
    </FORM>
    </BODY>
    </HTML>
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343
    Thanks monte96,

    This looks like exactly what I was looking for!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width