An HTML Form has a drop-down select list in which any option selected by the user will fire a JavaScript onChange event thereby changing the querystring of the URL. The querystring already has the user's loginid as one name-value pair. For eg. if a user has selected say, apple, from the drop-down menu, then fruit=apple will get APPENDED to the querystring (provided the user has selected an option for the 1st time). Next if he select mango, the querystring will CHANGE to fruit=mango. Please note that when a user selects an option, the onChange event gets triggered & the page comes back to itself (just the querystring in the URL changes). This Form also has a textbox where users can enter dates (in dd-mm-yyyy format). A default date is also specified for this texbox. Now this is what I am doing in the onChange event (suppose this file is named Fruit.asp):
<%
Dim strLoginID,strFruit
strLoginID=Request.QueryString("loginid"
strFruit=Request.QueryString("fruit"
%>
<script language="JavaScript">
function gotoURL(obj){
var str1=document.scope.fruit.value;
window.location.href=obj.options[obj.selectedIndex].value;
}
</script>
<body>
<form name="scope" action="SomePage.asp">
<input type=text name="putdate" value="31/1/2002">
<select name="fruit" onChange="gotoURL(this.form.fruit)">
<option value="Fruit.asp?loginid=<%= strLoginID %>&fruit=mango">Mango</option>
<option value="Fruit.asp?loginid=<%= strLoginID %>&fruit=apple">Apple</option>
<option value="Fruit.asp?loginid=<%= strLoginID %>&fruit=banana">Banana</option>
</select>
</form>
Now, as expected, when a user selects a fruit, the querystring changes accordingly. What I want is is there someway, maybe by using JavaScript (or even ASP will do!!), the date entered by the user (or the default date already specified) can also be passed to the querystring when an option is selected by a user from the drop-down menu?
Thanks,
Arpan
<%
Dim strLoginID,strFruit
strLoginID=Request.QueryString("loginid"
strFruit=Request.QueryString("fruit"
%>
<script language="JavaScript">
function gotoURL(obj){
var str1=document.scope.fruit.value;
window.location.href=obj.options[obj.selectedIndex].value;
}
</script>
<body>
<form name="scope" action="SomePage.asp">
<input type=text name="putdate" value="31/1/2002">
<select name="fruit" onChange="gotoURL(this.form.fruit)">
<option value="Fruit.asp?loginid=<%= strLoginID %>&fruit=mango">Mango</option>
<option value="Fruit.asp?loginid=<%= strLoginID %>&fruit=apple">Apple</option>
<option value="Fruit.asp?loginid=<%= strLoginID %>&fruit=banana">Banana</option>
</select>
</form>
Now, as expected, when a user selects a fruit, the querystring changes accordingly. What I want is is there someway, maybe by using JavaScript (or even ASP will do!!), the date entered by the user (or the default date already specified) can also be passed to the querystring when an option is selected by a user from the drop-down menu?
Thanks,
Arpan