It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, I tried to add a date input to the form with the order: year, month, day - national standard. The year doesn't get displayed. If the year is second or third then it displays fine.
No year:
echo $Sender->Form->Date('date', array('Fields' => array('year','month','day')));
Ok:
echo $Sender->Form->Date('date', array('Fields' => array('month','year','day')));
Comments
@csakip
I think you may need to set in locale.php or definitions.php whichever you are using. try modifying Date.DefaultFormat to see if you get the results you want.
e.g.
$Definition['Date.DefaultFormat']=''%Y %e %B';
the code - for Date in class.format.php
http://www.php.net/manual/en/function.date.php
or make your own routine if that doesn't work.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
-1 · Insightful Awesome LOL ·Thanks, but it's not about the displaying date as text but the date inputs on forms. (btw: nice work on the enhanced members list ;) )
- Spam
- Abuse
1 · Insightful 1Awesome LOL ·Thx. if you don't get help from anyone else and you want to post the whole routine code that I could actually run and experiment with - I would be glad to give it a try.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
1 · 1Insightful Awesome LOL ·That's all the code. Just try to add anywhere where you have a Form object:
$Sender->Form->Date('date', array('Fields' => array('year','month','day')));Only the month and day dropdowns will be displayed.
- Spam
- Abuse
-1 · Insightful Awesome LOL ·You are absolutely correct - it won't work - I think there is a bug in the code for /library/core/form.php
notice the concatenation is missing in the first switch statement so the loop will always drop the previous results. I haven't confirmed if it saves correctly but it does display the option boxes correctly.
can you confirm please?
if you need a year range option also - this works.
$this->Form->Date($mydate, array('yearrange'=>'1999-2004','Fields' => array('year','month','day')));without the change the sort works properly with out year (so we know the sorting ability was intended).
echo $this->Form->Date($mydate, array('Fields' => array('day','month')));
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
0 · Insightful Awesome LOL ·@Todd does this look like a bug and will the "change above" cause other problems.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
0 · Insightful Awesome LOL ·same issue in vanilla 2.1 on line 715
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
0 · Insightful Awesome LOL ·For visuals before adding the period before the equal sign in /library/core/form.php line 707
before
$Return = $this->DropDown($FieldName . '_Month', $Months, $Attributes);
results in image1 - if I use this form statement in a plugin
echo $this->Form->Date('date', array('Fields' => array('year','month','day')));
notice it drops the year
after correcting library/core/form.php line 707
changing = to .= for concatenation. results in image2
$Return .= $this->DropDown($FieldName . '_Month', $Months, $Attributes);
same echo statement echo $this->Form->Date('date', array('Fields' => array('year','month','day')));
also modified line 698 to initialize $Return to "" .
$Fields = ArrayValueI('fields', $Attributes, array('month', 'day', 'year')); // added this statement $Return = "";
click on the images to see full display.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
1 · Insightful 1Awesome LOL ·I must have some dyslexia. I've checked that part of the code for half an hour and didn't see the missing dot. :D Cheers, thank you.
- Spam
- Abuse
1 · Insightful 1Awesome LOL ·looking forward to your plugins. You have some great ideas.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
0 · Insightful Awesome LOL ·I'll fix that bug in Gdn_Form.
- Spam
- Abuse
1 · Insightful 1Awesome LOL ·- Spam
- Abuse
-1 · Insightful Awesome LOL ·Yes Boy its all good! www.google.com
- 1Spam
- Abuse
-1 · Insightful Awesome LOL ·http://www.facebook.com
- 1Spam
- Abuse
-1 · Insightful Awesome LOL ·