PDA

Click to See Complete Forum and Search --> : Urgent help please!! - NEWBIE


turfbult
Oct 10th, 2000, 04:14 AM
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.

Oct 10th, 2000, 04:31 AM
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

turfbult
Oct 10th, 2000, 05:57 AM
Thanks MarcelB,

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

monte96
Oct 10th, 2000, 10:00 AM
This will do what your looking for:


<%@ 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>

turfbult
Oct 10th, 2000, 01:07 PM
Thanks monte96,

This looks like exactly what I was looking for!!