Gossamer Forum
Home : Products : DBMan : Customization :

Date problems - HELP !!

Quote Reply
Date problems - HELP !!
I have been trying to get this working for a while now. What I need is to have users post dates using drop down menus for day, month and year. There are various reasons for this such as being able to search for an event on an exact date, or by month etc.

What I have done is to create 3 fields, EDAY, EMONTH and EYEAR and then make the Date field a hidden field in the form like <INPUT TYPE="HIDDEN" NAME="Date" VALUE="$in{'EDAY'}-$in{'EMONTH'}-$in{'EYEAR'}">.

This is giving me a real headache. When I post a record I get the old Invalid Date Format error. When I look at the source of the page with error I see that Date is for example 01-May-2001 which is the correct format. If I change the Date field to a text field and enter 01-May-2001 manually, it accepts it without error.

Obviously there is a problem with knitting these 3 field together to make a single field but I can't figure out why it shows in the source correctly but the database won't accept it in this format??

Any ideas are VERY WELCOME !!!!


Thanks,
FkMan


Quote Reply
Re: Date problems - HELP !! In reply to
If you are using 3 separate fields for the date you need to have an input field for each of those fields.

For the display you can combine the fields.
If you want to combine the fields for another purpose, check out the FAQ below under the section "Files / Records" or "Fields"

There's also a section for working with dates.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Date problems - HELP !! In reply to
Try taking the '&get_date()' (or whatever the syntax is) out of the "valid expression" part of the date field in default.cfg, and/or change the "type" to 'alpha' instead of 'date'. If your using a drop down list then chances are you don't *need* to insure the date is in a certain format. - Probably not the best way to do it, but it should work.