Forum OpenACS Q&A: Response to ad_form select fields howto

Collapse
Posted by Don Baccus on
He'll still have to do a "acquire" operation on it ... *if* he's using the form templater's built-in "date" type and widget (as opposed to a plain text field).

Something like this:

ad_form -name form_name -form {
   expiry_date:date,from_sql(linear_date)
} -select_query {
   select to_char(expiry_date, 'YYYY MM DD HH24 MI') ...
}
will convert the string format (called a "linear date" in format templater lingo, remember that I just wrote the ad_form wrapper) and assign it to expiry_date automatically.

The need to specify "from_sql" is a kludge to get around the fact that the form templater's data types don't give any way to determine if such conversion's necessary or not. I intend to add something like this in the future so conversion between the internal form and external forms can happen by default.

If you're just using a text field to store your date string rather than the fancy built-in date datatype/widget Lars's example works just fine.