[TYPO3-mvc] Fluid form with DateTIme as user input
Patrick Schriner
patrick.schriner at diemedialen.de
Fri Aug 23 12:28:44 CEST 2013
<label for="validUntil"><f:translate
key="tx_bla_domain_model_blub.valid_until" /> (Format: TT.MM.JJJJ)</label>
<f:form.textfield property="validUntil"
value="{blub.validUntil->f:format.date(format:'d.m.Y')}" class="tcal" />
should work if changed to accept date time. I can only recommend adding a
simple date picker like Tigra Calendar.
You should not need any magic in the model, you don't need to set it
explicitly - there is a special part in the property mapper that handles
datetime fields.
If that fails you,
http://forum.typo3.org/index.php?t=msg&th=196836&goto=685637&#msg_685637
looks promising.
Patrick
On Fri, 23 Aug 2013 12:11:01 +0200, Hendrik Nadler
<nadler at simplethings.de> wrote:
> Hi,
>
> im running mad about this: How is the "official" way to let the user
> enter/choose a datetime (e.g. "2013-08-23 12:24") in a fluid form?
>
> If i set a default in the constructor
>
> class Foo extends AbstractEntity
> {
> /**
> * @var \DateTime
> * @validate NotEmpty
> */
> protected $barTime;
>
> public function __construct()
> {
> $this->barTime = new \DateTime();
> }
> ...
>
> It is not possible for the user to change the dateTime with neither
>
> <f:form.textfield id=" barTime " property=" barTime " value="{foo.
> barTime ->f:format.date()}" />
>
> nor
>
> <f:form.textfield id=" barTime " property=" barTime " />
>
> Can´t find any exapmles for that:-/ Do i habe to create a dummy field
> and then set the user value in the controller?
>
> Regards, Hendrik
More information about the TYPO3-project-typo3v4mvc
mailing list