Task #9135

Task #26664: Clean up Form ViewHelpers

Task #26658: Make Form ViewHelpers consistent

FormViewHelper cannot get the value of DateTime

Added by Michael Feinbier almost 12 years ago. Updated almost 11 years ago.

Won't have this time
Start date:
Due date:
% Done:


Estimated time:
Has patch:



not quite shure if i did something wrong but I think I found a misbehaviour in the AbstractFormViewHelper. It seems that DateTime-Fields are not read correctly.

My model has a property:

 * Produktdatum
 * @var DateTime
 * @validate NotEmpty
protected $product_date;

Now if I try to read the value of the field in a form like this:

<f:form.hidden property="warranty_date" id="hidden_warranty_date" />

the value of the hidden form is empty.
The property itself is stored correctly because:
{f:format.date(date: '{newArticle.warranty_date}', format: 'd-m-Y')}
written just next to the hidden form gives me the correct date.

So I think the $this->getValue() in the AbstractFormViewHelper is not able to determine the value of the DateTime object? Maybe it should echo the Unix-Timestamp? (@12353534)


Updated by Michael Feinbier almost 12 years ago

There's a small typo above:
My model has two properties $product_date and $warranty_date which are both DateTime properties. But both fields behave the same. So just imagine the property mentioned above is $warranty_date


Updated by Sebastian Kurfuerst about 11 years ago

  • Parent task set to #26658

Updated by Bastian Waidelich almost 11 years ago

  • Status changed from New to Rejected
  • Priority changed from Must have to Won't have this time
  • Target version deleted (1.0 beta 2)
  • Has patch set to No

Hidden fields can only render string values.
If you want to put the timestamp of a DateTime into a hidden field you can do so like:

<f:form.hidden value="{f:format.date(date: '{newArticle.warranty_date}', format: 'U')}" name="yourpluginnamespace[warranty_date]" id="hidden_warranty_date" />

But preferably you should use a special DateTime ViewHelper (that could for instance display a JS calendar and store the date in a format the DateTimeConverter can handle)

Feel free to re-open if you don't agree

Also available in: Atom PDF