I have an application to record tasks which are saved on an agenda table, where each record is a task to run with it's own data.
I also have a full month view of a calendar, and I need to allow the operator to add a new record in some specific date by just clicking on that date.
I can customize that link to open the table and get into the add function with a link like this: "http://myserver/agenda_view.php?addNew_x=1"
but then, the default date will always be the "today" date (or whatever default value I have placed into the appgini parameters).
To make this default value dynamically set, I need to send in the link, the date of the calendar-day-clicked.
In other words, what is the name of the variable to get a default value for a date field? is this possible?
I already have tryed several ways which none of them works:
(where $add_date has the value of ie. 2015-12-30 as well as $add_year, $add_month, $add_day which are "2015","12","30")
"http://myserver/agenda_view.php?addNew_ ... =$add_Date"
"http://myserver/agenda_view.php?addNew_ ... =$add_date"
"http://myserver/agenda_view.php?addNew_ ... y=$add_day"
Anybody that have tried this?
How to set a dafault date value for a date input field?
Re: How to set a dafault date value for a date input field?
Your AppGini application won't handle the date parameter you send to the page. You have to add code (possibly to the tablename_dv hook) to retrieve the parameter and then set the date field value to that parameter. Maybe this would work (but I didn't test it) if you put it in the tablename_dv function:
Replace 'TaskDate' in the above code with the actual date field name.
Code: Select all
$date_ts = strtotime($_GET['date']);
$date_day = date('j', $date_ts);
$date_month = date('n', $date_ts);
$date_year = date('Y', $date_ts);
$html .= "<script>\$j(function(){
\$j('#TaskDate-dd').val('$date_day');
\$j('#TaskDate-mm').val('$date_month');
\$j('#TaskDate').val('$date_year');
});</script>";

- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.
Re: How to set a dafault date value for a date input field?
Sorry for my late response to your much appreciated code but I forgot to thank you Ahmed,
That routine worked perfectly!
That routine worked perfectly!
Re: How to set a dafault date value for a date input field?
You're always welcome 


- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.