Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Current Version (Old)
 Listbox Question
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

e3stone
Average Member

USA
885 Posts

Posted - 08 May 2001 :  04:29:31  Show Profile  Send e3stone an AOL message
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  Show Profile  Visit HuwR's Homepage
Yes it is possible, could you post the code for one of you drop downs, and I will show you how it is done

Go to Top of Page

e3stone
Average Member

USA
885 Posts

Posted - 08 May 2001 :  04:39:57  Show Profile  Send e3stone an AOL message
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
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20600 Posts

Posted - 08 May 2001 :  06:15:45  Show Profile  Visit HuwR's Homepage
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

Go to Top of Page

e3stone
Average Member

USA
885 Posts

Posted - 08 May 2001 :  06:40:26  Show Profile  Send e3stone an AOL message
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
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20600 Posts

Posted - 08 May 2001 :  06:52:50  Show Profile  Visit HuwR's Homepage
mydate = "1/1/2001"

arrDate = split(myDate,"/")

day = arrDate(0)
month = arrDate(1)
year = arrDAte(2)

Go to Top of Page

e3stone
Average Member

USA
885 Posts

Posted - 08 May 2001 :  08:42:02  Show Profile  Send e3stone an AOL message
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
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20600 Posts

Posted - 08 May 2001 :  09:21:32  Show Profile  Visit HuwR's Homepage
it may be a variable conversuion thing, try doing this

cInt(myDay) = dayCount

Go to Top of Page

e3stone
Average Member

USA
885 Posts

Posted - 08 May 2001 :  10:13:44  Show Profile  Send e3stone an AOL message
Yep, that worked, Huw. Thanks for your help on this. Its working.

<-- Eric -->


http://insidewaco.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.32 seconds. Powered By: Snitz Forums 2000 Version 3.4.07