It was an accident...
'Jaynestown'
Buffistas Building a Better Board ++
Do you have problems, concerns, or recommendations about the technical side of the Phoenix? Air them here. Compliments also welcome.
Uh huh.
I had to go out, but I gave this some thought. As interesting as it would be to solve this problem, I think there's a more practical solution. I understand trying to limit the choices to possible values, but you're almost always going to end up with invalid choices, particularly with the month and day fields. My recommendation would be as follows:
Year: Continue with the way it is now. It's fairly inexpensive performance-wise to find the minimum and maximum dates in a thread and extract the year from those dates.
Month: List all months, Jan - Dec (you can keep the digits behind the scenes with the html 'value' tag if that's more convenient... humans tend to understand three digit months faster than translating a digit).
Day: List all days, 1 - 31.
The worst that will happen if the user selects an invalid date (i.e. a date not within the thread's time frame) is no posts are returned. You can clue the user into valid dates by printing the first post date nearby, if you want. Hmm... not sure what the behavior would be if a user selected Feb 31, 2005 (for example). I suppose you're going to need some date validation code before using the supplied date in a query.
This way, you save yourself a couple of queries per page view and it simplifies things which is usually a good thing.
The worst that will happen if the user selects an invalid date (i.e. a date not within the thread's time frame) is no posts are returned.
That's not what happens. Currently, if you enter a date for which there are no posts, it sends you to the next date for which there are posts. So if you pick a date before the thread was started, then it goes to the first post, e.g., if you enter the date 8/1/2005 in the boxes for Natter 38, it takes you to the first post in the thread, bon bon "Natter .38 Special" Aug 21, 2005 7:59:15 pm PDT.
If you enter 7/14/2003 in the Sang Sacre thread, you get shifted to the next date for which there are posts, Elena's Husband "Sang Sacré 1: It's a Blood, Blood, Blood, Blood World" Jul 18, 2003 8:30:55 pm PDT.
That part of the system works fine. What doesn't seem to work is the months box once posts are made in October of this year, and I don't see how what you're proposing would fix that..
It appears that there is code that inspects the thread and determines the months in use in that thread. This code limits the months available in the month box. In some threads, the available months are 6, 7, 8... others, it's the full 1 through 12.
Example, this thread only has months 2 and 3 because the thread began in February and ends in March Topic!Cindy "Natter 33 1/3" Feb 22, 2005 12:45:04 pm PST
I'm suggesting that we do away with this code and always present months 1-12 Jan-Dec and days 1-31 as options.
Except the code was working up until October 1, so why not try to fix what may be a simple problem rather than scrapping it and going to a much less elegant solution?
I'm advocating scrapping because the code in place doesn't do what it attempts. It's trying to limit entered dates to ones within the thread's timeframe. The way it's structured, it's still possible to enter dates outside of the timeframe (in some cases).
Secondly, I don't see the value of doing a couple of extra queries on every page view, especially when that control is used relatively infrequently (granted, assumption), for little gain.
Listing all of the months and all of the days is quite straightforward and it doesn't appear that things will go poof if invalid dates are supplied by the user.
There are no extra queries on the page view, but thanks for looking out, Eddie.
I'll try debugging the code before I throw it out. I apologise to anyone who's had their browsing broken by this, but I'm unlikely to get to it before this coming Sunday.
Suggestion for the Request Queue:
Sometimes in this thread and Buffistechnology, it would be helpful to upload a text file with code (for example) rather than try to format the code so that B.org parses it correctly. There could be a hyperlink next to Mark and Block... possibly View or File? that would display the attached text (unformatted) in another browser window when clicked.
We'd probably want to limit the uploaded file size to maybe 50k. I imagine there are bandwidth and file space and security considerations.
Thoughts?
Or you could upload the file to yousendit.com, and then include the link in the post.
There are some very good reasons for the posting restrictions we have, mostly based on past abuse noted at other boards. The last thing anyone needs to see is photos of Charlie Daniels showing up in every thread.