Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Insert Date in Custom Form

Quote Reply
Insert Date in Custom Form
I have setup a series of custom forms for the add form, modify form, delete form etc etc. How do you insert the Add Date into the corresponding db.

In DBMan I remember using &get_date but when I use that in DBManSQL it does not seem to work?

I have set the field type to DATE in the properties and when the autogenerate forms were used the proper date was added. So far have tried putting &get_date in the default field, <%&get_date%> and all other combination in the template with no luck.

Suggestions

Thanks in advance

Christian
Quote Reply
Re: [orthonet] Insert Date in Custom Form In reply to
Hi,

I created a hidden, not-null date column without a default value:
Code:
'creation_date' => {
'file_max_size' => '',
'file_save_in' => '',
'file_save_scheme' => 'HASHED',
'file_save_url' => '',
'form_display' => '',
'form_size' => '',
'form_type' => 'HIDDEN',
'not_null' => '1',
'pos' => '6',
'regex' => '',
'type' => 'DATE'
},
For some reason, the creation date is set to the current date each time a record is created (without doing anything in the templates). I have no idea why this works (I use DBMan SQL 2.1.0 and Postgres), but it does. Laugh

Jasper

http://www.bookings.org
Quote Reply
Re: [orthonet] Insert Date in Custom Form In reply to
Hi,

You can create a global template called 'set_date'

sub {
require GT::Date;
return GT::Date::date_get();
}

And then add a hidden object into the customized add/modify forms:

<input name="field_name" type=hidden value="<%set_date%>">

Hope that helps.

TheStone.

B.
Quote Reply
Re: [TheStone] Insert Date in Custom Form In reply to
TheStone,

Just what I was looking for. Had a feeling it was simple.

Jasper,

Thanks. The autogenerated forms for DBMan SQL work like you say with nothing entered by default but if you make customized forms you need to pass values like TheStone mentioned.

Christian