Author |
Topic  |
|
e3stone
Average Member
  
USA
885 Posts |
Posted - 08 May 2001 : 04:29:31
|
I'm using 3 listboxes for the members to input month/day/year of their birthdays. I'm passing those values to make a string in the format of mm/dd/yyyy and storing that in the db. Whenever the age is needed (like on the pop_profile) I just translate that string into an 'age'
The question I have about the listboxes, is when the member goes to edit their profile, the listboxes display the first index value, i.e. January 1 1900. When I pull the birthday value from the database and spilt it into mm,dd,yyyy I'd like to have the listbox display those values instead of the first value in the select option list. Is there a way I can set the listbox index to a certain number?
<-- Eric --> 
http://insidewaco.com |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 May 2001 : 04:33:26
|
Yes it is possible, could you post the code for one of you drop downs, and I will show you how it is done
|
 |
|
e3stone
Average Member
  
USA
885 Posts |
Posted - 08 May 2001 : 04:39:57
|
I think I need to start reading my books I have sitting around here before I jump on and ask these questions I think I found out how to do it. here's my code:
<select name="birthday_month" size="1"> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select>
Wouldn't I just code it like this if I wanted December selected? <option value="12" SELECTED>December</option> ?
however, I'm not entirely sure how to set the specific <option> as selected once I find out which month their birthday is.
hmmm, I still haven't been able to figure out a way to do this....
<-- Eric --> 
http://insidewaco.com
Edited by - e3stone on 08 May 2001 06:00:02 |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 May 2001 : 06:15:45
|
let's say you have queried your db, and assigned the month field to a variable myMonth.
you would then do this
<select name="birthday_month" size="1"> <option value="1" <% if myMonth = 1 then response.write "selected" else response.write "" %> >January</option>
and so on
|
 |
|
e3stone
Average Member
  
USA
885 Posts |
Posted - 08 May 2001 : 06:40:26
|
How would I split a string of 1/1/2001 into seperate variables of month, day, and year? I'm confused because sometimes the month with be one character (january) and sometimes 2 characters (october on)
<-- Eric --> 
http://insidewaco.com |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 May 2001 : 06:52:50
|
mydate = "1/1/2001"
arrDate = split(myDate,"/")
day = arrDate(0) month = arrDate(1) year = arrDAte(2)
|
 |
|
e3stone
Average Member
  
USA
885 Posts |
Posted - 08 May 2001 : 08:42:02
|
Thanks for your help, Huw. I thought this code would work:
<select name="birthday_day" size="1"> <% for daycount=1 to 31 %> <option value="<%=daycount%>" <% if myDay = daycount then response.write "selected" else response.write "" %>><%=daycount%></option> <% next %> </select> but, it doesn't seem to work. Any ideas?
<-- Eric --> 
http://insidewaco.com |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 08 May 2001 : 09:21:32
|
it may be a variable conversuion thing, try doing this
cInt(myDay) = dayCount
|
 |
|
e3stone
Average Member
  
USA
885 Posts |
Posted - 08 May 2001 : 10:13:44
|
Yep, that worked, Huw. Thanks for your help on this. Its working. 
<-- Eric --> 
http://insidewaco.com |
 |
|
|
Topic  |
|