Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8185043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:42:36+00:00 2026-06-07T01:42:36+00:00

I have the following situation: a form field type date a validation pattern like

  • 0

I have the following situation:

  • a form field type date
  • a validation pattern like dd.mm.YYYY
  • a helper object that turns 12 into 12.07.2012 or 2.5 into 02.05.2012 etc.

My question is: Where do I call the method that transforms the input value?

When I call it from the set-method of the entity, the value actually gets changed. But when loading the form again (e.g. incomplete submit) the old value (like 2.5) and not the transformed value (2.5.2012) is shown. Now, how do I tell the form, that the value has changed within the entity?

Maybe there’s also another way of doing it in-between:

$form->bindRequest($request);
// do some fancy stuff here
if ($form->isValid()) {}

PHP

This is from the Entity:

/**
 * @ORM\Column(type="datetime", nullable=true)
 * @Assert\DateTime()
 */
protected $date_start;

This is from the Type:

$builder->add('date_start', 'datetime', array(
    'label' => 'Start Datum/Uhrzeit',
    'date_widget' => 'single_text',
    'time_widget' => 'single_text',
    'date_format' => 'dd.MM.yyyy',
    'with_seconds' => false,
    'required' => false,
));
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:42:38+00:00Added an answer on June 7, 2026 at 1:42 am

    There are two ways to modify forms and the data bound to them. You can use form events, there is an example of their use here or you can use a DataTransformer which is explained here

    From the sound of your case I think a DataTransformer makes the most sense. You are representing the data in the object in one way but you need to present it in the form in a different way, and reverse that transform when the form is submitted. This is purpose of the DataTransformer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Picture the following situation. I have an XML document as follows, <Form> <Control Type=Text
I have the following situation that I would like to handle in JSF. My
I have following Situation, Server A sends some data (HTML form) to server B,
I have a situation that if my form doesn't validate I need it to
I have the following situation: there is a table in the DB that is
I have the following situation: I built an Access form with a subform (which
I have the following situation in my python code: class Parent(object): def run(self): print
hello i have the following problem: i have a form in that i would
I would like to program the following situation: I have 2 different ListViews in
I have following situation - Have a MongoService class, which reads host, port, database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.