0

first look: enter image description here

i have made this DB structure with entities than dumped and visualised.

Adding things to DB from phpMyAdmin or displaying data from code is no problem, but when i try to build form using formtype like:

  1. main form is CV (curriculum vitae)
  2. this contains one text field
  3. relation to skills of user (skill, degree) (now i can only select existing skill of the user, added through phpmyadmin)
  4. same as skills for employments, schools,..

my mind want to blow from weirdness. Can someone help me?

I want to build form where i can fill anything on one page. Eg.:

  1. user writes something about himself

  2. for example he clicks on add new school, and form for schools will appear, if he have more schools, he can add another (without reloading page and saving actual form)

  3. same with employments, click add new,...

  4. at skills he can select the skill he knows (for example C++ Programing), click add and than can select or enter the degree (0 Begginer, 1...3 Expert). Adding more needs to be possible as with 3. and 2.

  5. as final step he clicks on the "Save CV"

And anything done.

I have tried:

         ->add('skills', 'collection', array(
                'type' => new SkillsType(),
                'label' => 'Skills',
                'error_bubbling' => true,
                'cascade_validation' => true,
                    ))

With Template:

{{ form_start(form) }}
{% for skill in form.skills %}
    <li>
        {{ form_widget(skill) }}
    </li>
{% endfor %}
{{ form_end(form) }}

to add skills then i wanted to use the same for adding employments.

At wort i will make manual form with couple of javascript.

Thankyou

1 Answer 1

1

The Collection field type is what your using. If you havent already its work looking at the Documentation for it.

You can do what you want by using the prototype property which Symfony will add to your form if you add the allow_add option in your form builder.

Collection Field Type

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

3 Comments

thankyou i wil lcheck it tommorow, you answer seems to work in theory
Oh its fantastic, works like charm with custom prototype data template. Thank you once more
Your welcome, I have used it before and yeah it seems to work. If I have to do it again I would improve the JS they recommend but thats just me :)

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.