[ic] date widget format data

Paul Jordan interchange-users@icdevgroup.org
Wed Dec 18 19:40:01 2002


> Hello List,
>
> IC. 4.8.3 on RHL 6.2, mySQL data.
>
> I'm trying to use a date widget for customers to select a date for an
> e-product to send to a gift recipient.  I have everything
> together except
> the date widget part:
>
> [widget type=date NAME=datetosend]
>
> This creates a form like this:
>
> <select name=datetosend><option value="01">January (etc. to december)
> <input type=hidden name=datetosend value="/">
> <select name=datetosend><option value="01">01 (etc to 31)
> <input type=hidden name=datetosend value="/">
> <select name=datetosend><option value="2001">2001 (etc to 2012)
>
> This value seems to carry just fine across multiple forms in
> the IC checkout
> process.  Where it gets messy is when I try to log this date
> to an SQL data
> table:
>
> in etc/log_transaction:
>
> Added [item-code] to gift_memberships: [import table=gift_memberships
> type=LINE continue=NOTES]
> (bunch of stuff added)
> date_to_send: [value datetosend]
> [/import]
>
> What I get in the data table is just the number for the month that was
> selected.  The field is set to varchar(255).
>
> Another problem is I'd like to be able to have my date value
> formatted as
> YYYY-MM-DD.
>
> So, two questions:
>
> 1.  How can I get a date widget value to store to the DB with the full
> string instead of just the first part?
> 2.  How can I get the date widget to format the value to YYYY-MM-DD?
>
> Thanks,
>
> Russell

Hi Russell,

I didn't even know about the [widget] tag... I will have to look into
that. You can also use the [display] tag, and set the fields widget type
in the table editors metadata. This works for me.

[display table=gift_memberships column=datetosend key=""]

then setup the date widget with the "date selector" filter in Admin.

Paul