Dwayne,

This code would go at the top of your page within the script tags.

If Request("selected_month") <> "" Then
        selected_month = Request("selected_month")
Else
        selected_month = DatePart("m", Date())
End If

Your select would then make a match on select_month to the month and
select the correct one. I didn't really mess with your onchange. You say
that you have that part working, so I just popped in your code snippet
so that I could show how to put the if statement with in the option
block.


<select name="optMonth" size="1" id="optMonth"
onchange="document.location.href = myPage.asp?selected_month=x;">
            <option value="0" <%if selected_month= 0 then %>selected<%
end if %>></option>
            <option value="1" <%if selected_month= 1 then %>selected<%
end if %>>Jan</option>
            <option value="2" <%if selected_month= 2 then %>selected<%
end if %>>Feb</option>
            <option value="3" <%if selected_month= 3 then %>selected<%
end if %>>Mar</option>
            <option value="4" <%if selected_month= 4 then %>selected<%
end if %>>Apr</option>
            <option value="5" <%if selected_month= 5 then %>selected<%
end if %>>May</option>
            <option value="6" <%if selected_month= 6 then %>selected<%
end if %>>Jun</option>
            <option value="7" <%if selected_month= 7 then %>selected<%
end if %>>Jul</option>
            <option value="8" <%if selected_month= 8 then %>selected<%
end if %>>Aug</option>
            <option value="9" <%if selected_month= 9 then %>selected<%
end if %>>Sep</option>
            <option value="10" <%if selected_month= 10 then %>selected<%
end if %>>Oct</option>
            <option value="11" <%if selected_month= 11 then %>selected<%
end if %>>Nov</option>
            <option value="12" <%if selected_month= 12 then %>selected<%
end if %>>Dec</option>
            </select>

HTH,

Cheryl Hewitt

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 27, 2004 3:07 PM
To: [EMAIL PROTECTED]
Subject: [wdvltalk] Passing value to self based on user event


I have what seems a relatively simple task.  Build a drop-down list of
months that defaults to the current month.  If the user has selected a
different month, we reload the page with the selected month -- the
onchange event in the dropdown does:

   document.location.href = myPage.asp?selected_month=x

With "x" being the value of the drop-down.  That works fine... but how
to handle inital load?  I tried:

   user_selection = request("selected_month")
   if isNull(user_selection) then
      today_date = date()
      selected_month = month(today_date)
   else
      change_month = selected_month
   end if

This doesn't work.  I also tried rather than isNull if user_selection =
0 but that also seems to fail.

This is prolly a simple fix but can't see the forest pass the trees.  

Appreciate any help...


  

____ * The WDVL Discussion List from WDVL.COM * ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with
the words: "set WDVLTALK pw=yourpassword" in the body of the email. To
change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as:
[EMAIL PROTECTED] To unsubscribe send a blank email to
%%email.unsub%%

To unsubscribe via postal mail, please contact us at: Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set 
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to