Print Page | Close Window

Whats wrong with this code?...

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=6106
Printed Date: 31 March 2026 at 1:36am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Whats wrong with this code?...
Posted By: vidyaraghav
Subject: Whats wrong with this code?...
Date Posted: 02 October 2003 at 4:56am

Can you please tell me whats wrong with the following code

<script language="JavaScript">

function searchForAll(theForm)

{

//first if date has value and userid is null

if((theForm.date.value != "") && (theForm.useridsel[theForm.useridsel.selectedIndex].value == "null"))

{document.write("The date value is "+theform.date.value);

strUrl = "Files1.asp?dt="+theForm.date.value;

location.href = strUrl;

}

}

//second if date has no value and userid has a value

else if((theForm.date.value == "") && (theForm.useridsel[theForm.useridsel.selectedIndex].value != "null"))

{

document.write("The date value is "+theform.date.value);

strUrl = "Files2.asp?uid="+theForm.useridsel[theForm.useridsel.selectedIndex].value;

location.href = strUrl;

}

}

// third if date and userid both have values

else if((theForm.date.value != "") && (theForm.useridsel[theForm.useridsel.selectedIndex].value != "null"))

{

document.write("The date value is "+theform.date.value+"and the user id is "+theform.useridsel[theform.useridsel.selectedindex].value);

dataValue = theForm.date.value;

selectedUserid = theForm.useridsel[theForm.useridsel.selectedIndex].value;

strUrl = "Files1.asp?uid="+selectedUserid+"&dt="+dataValue;

location.href = strUrl;

}

}

// if date and userid both have no value

else if((theForm.date.value == "") && (theForm.useridsel[theForm.useridsel.selectedIndex].value == "null"))

{

document.write("The date value is "+theform.date.value,"+the user id "+theform.useridsel[theform.useridsel.selectedindex].value);

strUrl = "adminDownloadFiles.asp?dt=";

location.href = strUrl;

}

}

}

</script>

<form name="frm" method="post" action="">

<table width="100%" border="0" cellspacing="0" cellpadding="2">

<tr>

<td width="10%"><b>UserId:</b></td>

<td width="20%">

<select name="useridsel" >

<option value="null">All</option>

<option value="1" >Akshara</option>"

</select>

</td>

<script language="javaScript">

t = 0;

strState = "<%=trim(M_UserId)%>";

for (i=0;i<document.frm.useridsel.length;i++)

if(document.frm.useridsel.value == strState) t=i;

document.frm.useridsel[t].selected = true;

</script>

 

<td width="10%">&nbsp;</td>

<td width="10%"><b>Date:</b></td>

<td width="20%">

<input type="text" name="date" size="12" maxlength="10">

</td>

<td width="30%">

<input type="button" name="Button" value="Search" onClick="searchForAll(this.form)">

</td>

</tr>

</table>

</form>

</td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

</table>




Replies:
Posted By: Bullschmidt
Date Posted: 02 October 2003 at 6:39am
You may want to ask in a JavaScript board like http://www.codingforums.com/forumdisplay.php?s=&forumid=2 - http://www.codingforums.com/forumdisplay.php?s=&forumid= 2

-------------
J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com - www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)


Posted By: KCWebMonkey
Date Posted: 02 October 2003 at 6:54am

If you want people to help you, you need to offer as much information about your problem as you can.

If you are getting an error in your javascript, you should post the error that you are getting.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net