Gossamer Forum
Home : Products : DBMan SQL : Discussion :

html code for date display

Quote Reply
html code for date display
I am building a custom add_form.html file for DBMan SQL 2. One of the form inputs is for the date. What html code do I add so the current date will auto display in the form?
Quote Reply
Re: [jayridgway] html code for date display In reply to
You should create a global template called 'get_date':

sub {
my $field_name = shift;
my $tags = GT::Template->tags;
my $home = $tags->{home};
require GT::Date;
GT::Date::date_set_format('%mm%-%dd%-%yyyy%');
$home->{db}->cols->{$field_name}->{default} = GT::Date::date_get();
}

Change add_form.html like:

....
<%get_date('your_date_field_name')%>
<%generate_add_form%>
...

Hope that helps.

TheStone

B.
Quote Reply
Re: [TheStone] html code for date display In reply to
That worked great!

Thanks,

Jay
Quote Reply
Re: [jayridgway] html code for date display In reply to
Do I add this code

Code:
<%get_date('creationdate')%>
<%generate_add_form%>


at the top of the add_form.html? or do I put it in:

Code:
<INPUT name=creationdate type=text value="<%if creationdate%><%creationdate%><%endif%>">


Also, I am using the same html page for my add record and modify record so will I have to make two separate html files for these pages since I want to have the date field auto filled? Thanks Smile
Reena
Quote Reply
Re: [Reena0330] html code for date display In reply to
Also, How do I set up the date field such that if the field is empty then fill it with the current date otherwise if it has a value then leave it alone? Crazy
Reena