Re: XoopsFormDateTime empty field?
|
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() ![]() |
To do this I have made this function.
function pf_dateForm($c, $n, $s, $v, $alt='calendar') and then into script: $form -> addElement( pf_dateForm(...) ); However, I needed only date form without time, but I think it would be easy to add. In my solution I replace the standard button [...] by image located in '/modules/mymodule/images/date.png'.
Posted on: 2010/1/7 11:35
|
|||
|
Re: XoopsFormDateTime empty field?
|
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() ![]() |
NOTICE: This my function from above doesn't work since Xoops 2.5.4. There were changes in xoops calendar and the file: /include/calendarjs.php even not exist in the latest Xoops.
Posted on: 2012/1/18 10:59
|
|||
|
Re: XoopsFormDateTime empty field?
|
||||
---|---|---|---|---|
Not too shy to talk
![]() ![]() ![]() |
Better solution - use OOP: extend original class XoopsFormTextDateSelect and add parameter $autofill
class pfFormTextDateSelect extends XoopsFormTextDateSelect Moreover this class accepts English textual datetime description and convert it into a timestamp (see http://php.net/manual/en/function.strtotime.php). Example, this displays a later date by one day: new pfFormTextDateSelect('', 'test', 10, '+1 day', false); Empty field: new pfFormTextDateSelect('', 'test', 10, '', false);
Posted on: 2012/1/19 12:11
|
|||
|
Re: XoopsFormDateTime empty field?
|
||||
---|---|---|---|---|
Moderator
![]() ![]() ![]() |
Yes, that was a very good solution!
And it shows how searching on the XOOPS Website can help people to avoid reinvent ing the wheel! ![]() A client of mine wanted to have a Calendar field that would show as a default "YYYY/MM/DD", and to only change after the user clicks on the "calendar button". If not, it would save to the database the default value "YYYY/MM/DD". I was curious if somebody was faced with similar issue, and I've found your post, and with a small modification, it was perfect! So thank you for sharing! It was helpful and it saved me some time! And it demonstrates nicely the power of OOP! ![]()
Posted on: 2013/8/24 22:46
|
|||
|
You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.