Fix select duplication #1129

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

EmmanuelVella commented Jan 29, 2013

Fix the select elements duplication in case of validation error.

Owner

rande commented Jan 29, 2013

You are removing DOM inserting here, why ?
Can you explain how to reproduce the behavior ?

Contributor

EmmanuelVella commented Jan 29, 2013

You are right, I should keep the inserted span. BTW there is still an issue with the following code :

target = jQuery('span', element);

If more than one span are in the element, the input (select) field will be duplicated because of this code :

jQuery(input).appendTo(target);

Let me update my PR.

Fix select duplication
Fix the select elements duplication in case of validation error.
Contributor

EmmanuelVella commented Jan 29, 2013

I just updated my PR. I wrap the select with a span, then I choose this span as qtip target.

Owner

rande commented Feb 4, 2013

Can you tell me how to reproduce this issue ?

Contributor

EmmanuelVella commented Feb 5, 2013

This happens on sonata_type_model form fields. I reproduced the issue in the sandbox.

In the PostAdmin, add an empty_value and remove the required option to the author field :

->add('author', 'sonata_type_model', array('empty_value' => '', 'required' => false))

Then in the Post entity validation.xml file, set the author to be not null :

<getter property="author">
    <constraint name="NotNull" />
</getter>

Now create (or update) a post without selecting an author : the field should be here 3 times, making update impossible.

sonata_type_model

Owner

rande commented Mar 27, 2013

cherry picked and merged into 2.1/master

@rande rande closed this Mar 27, 2013

Contributor

EmmanuelVella commented Mar 27, 2013

Thanks

@EmmanuelVella EmmanuelVella deleted the EmmanuelVella:patch-5 branch Mar 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment