[TYPO3-mvc] Date examples, can't find any.
Christine Gerpheide
cgerpheide at gmail.com
Tue Jan 12 12:25:57 CET 2010
Hi Nathan,
What I have done in my new.html is have the form field like you have yours:
<label for="startdate">Launch Date</label><br />
<f:form.textbox property="startdate" /><br />
And the setStartdate() method creates the DateTime object:
/**
* Setter for startdate. String provided must be able to be parsed with
strtotime.
* For instance, 'October 29th, 2009', '10/29/2009', or '29.10.2009'. If
not provided,
* date defaults to today.
*
* @param string $startdate e.g. '10/29/2009', '29.10.2009', etc
* @return void
*/
public function setStartdate( $startdate) {
$this->startdate = new DateTime($startdate);
}
Then in edit.html, you have to use the DateTime view helper to parse the
date, which can then be edited:
<label for="startdate">Launch Date</label><br />
<f:form.textbox property="startdate" value="<f:format.date
format='{settings.dateFormat}'>{campaign.startdate}</f:format.date>"/><br />
Would love to know if there's a better way, but hope that helps!
Christine
2010/1/11 Nathan Lenz <typo3 at k9tfk.com>
> Let's take the date property of Tx_Blogexample_Domain_Model_Post.
>
> What would I add to new.html and edit.html in order to add a simple form
> element for editing the date?
>
> I tried the most obvious but it didn't work. I dug around the form
> viewhelpers and couldn't find anything related to dates.
>
> <label for="date">Date:</label>
> <f:form.textbox property="date" />
>
> Thanks for any pointers,
> --Nathan Lenz
>
>
> (I'm not asking about how to add the javascript calendar... just how to
> show a DateTime property in a text box, allow someone to edit it and
> then save it back to the object.)
>
> Maybe this isn't possible yet? Google found this issue in Flow3 for me:
> http://forge.typo3.org/issues/show/4268
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
More information about the TYPO3-project-typo3v4mvc
mailing list