actual date in datetime picker in Field Default Value

wiesiuwies 13 Feb, 2013
Hello

How to get a var to inside "Field Default Value" actual date ? For help big thanks
GreyHead 13 Feb, 2013
Hi wiesiuwies,

Plese try using the Custom MooTools DatePicker action in the On Load event of your form and set 'Allow Empty ?' to No.

Bob
wiesiuwies 13 Feb, 2013
Thanks for answer i try do that and 'Allow Empty ?' put to No but doesn,t work. Other parametres in Custom MooTools DatePicker works but changing Allow Empty to NO does not make difference. Please help me. Maybe exist others method to put actual date to field aera in TEXT BOX? For answet big thanks
GreyHead 13 Feb, 2013
Hi wiesiuwies,

Sorry about that :-(

Please try this next . . . add a Custom Code action into the On Load event and add this code replacing 'input_name' with the name of your date-picker input and setting the correct date format string:
<?php
if ( !isset($form->data['input_name']) || !$form->data['input_name'] ) {
  $form->data['input_name'] = date('Y-m-d');
}
?>

Bob
wiesiuwies 14 Feb, 2013
Hello

Thank you GreyHed, works perfect. I have only one question how to write in code that the date in field was displayed with 1 day or 1 month interval ? for answer sincere thanks...
GreyHead 14 Feb, 2013
Hi wiesiuwies,

Sorry I don't understand your question. Please see this FAQ which may help.

Bob
wiesiuwies 14 Feb, 2013
I want ask how to show actual date with the one month dealy. Example today we have 2013-02-14, then i need to show date one month earlier 2013-01-14. Is it possile ? For answer thanks ...
GreyHead 14 Feb, 2013
Hi wiesiuwies,

As the FAQ says, the PHP documents or StackOverFlow will tell you how to set another date. Here's one example I found with Google on StackOverFlow.

Bob
This topic is locked and no more replies can be posted.