1

I have some problem. How set default value for choice or enitity form type ()? I don't need prefffered choice or empty value. How to add this options?

2 Answers 2

2

Use the data option. Details are in the reference.

Sign up to request clarification or add additional context in comments.

1 Comment

do you know anything about the empty_data option for form fields? I'm not sure if this question is looking for that, but I am, and I can't get it to work. See: stackoverflow.com/questions/24792285/…
1

Default values are no options, it uses the second argument of the form constructor.

5 Comments

Yes, but my form class don't entity object. I have some filter with parameters.
The first sentence of your first comment seems to be lacking a word.
I have custom filters, for example type, area, rooms as array and city, region, district as entity. After search i want save filter values for next search.
When I said trying a simple array, I meant trying something like this : array('type' => 'image', 'area' => 'jungle', rooms => array('room1', 'room2', 'city' => new City('Paris')));
Thanks, but I done this save filter using js and url parameters :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.