formbuilder
How do I get the HTML ‘name’ attribute a rails form builder will generate for a certain field?
After inspecting the form object, I found that you can get the object_name from it. So this worked well for me: “#{f.object_name}[field_name]” Which will generate: object[object_attributes][0][field_name]
fields_for form builder object is nil
You must have accepts_nested_attributes_for in the Project model in order for the object to be passed. class Project < ActiveRecord::Base has_many :tasks accepts_nested_attributes_for :tasks ## this is required end
Symfony2 file upload step by step
Do you know now what are the ‘important’ function to add to be able to upload the photo and rename it? See the official documentation on how to do this. There are good working examples for a simple file upload. Also check the doctrine documentation for lifecycle callbacks. How do you check the extension to … Read more
How to set a class attribute to a Symfony2 form input
You can do this from the twig template: {{ form_widget(form.birthdate, { ‘attr’: {‘class’: ‘calendar’} }) }} From http://symfony.com/doc/current/book/forms.html#rendering-each-field-by-hand