Yes you can. The actual "hiding" would be carried out on the client
side with Javascript, by setting the "display" css attribute of the
field to "none".

You would also need to implement proper validation in the Entity
backing the form so that it ignores the additional fields that are not
required for the blog.

That being said, this isn't a particularly clean way to do this. It
would make more sense to use inheritance and have a base class called
"Content" and two classes that extend it called "Blog" and "Test".
Then you can more cleanly encapsulate the behavior of both.

On May 4, 10:03 am, Manu <[email protected]> wrote:
> Hi everybody, I have a blog written in symfony 1.4 that I'm going to
> rewrite in Sf2. I'm wondering if the following is possible in Sf2 :
>
> Can I have a form, where some fields are shown/hidden according to the
> selected field in some combobox ?
>
> Practical example : I have a table, named "contents", that can contain
> either blog posts or "test" (reviews of books, movies, etc.). For
> tests, I have a few extra fields that aren't required in blog posts,
> such as "amazon link", "rating", and so on. Could I hide those fields
> when an author selects "blog" as the type of the content he's writing ?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to